System.Data.OracleClient
OracleConnection.ConnectionString 属性
下表为 ConnectionString 内的值列出了有效的名称。
| 名称 | 默认值 | 说明 | 
| 数据源或服务器 | 要连接的oracle实例的名称或网络地址 | |
| 集成安全性 | 'false' | 该连接是否为安全的连接。 可识别的值为 true(极力建议使用)、false、yes 和 no。 | 
| 密码 | Oracle 帐户的登录密码(建议不要使用。为了保持较高的安全级别,极力建议您改用集成安全性关键字。) | |
| 持续安全信息 | 'false' | 当设置为 false 或 no(强烈建议)时,如果连接是打开的或者一直处于打开状态的 State,那么安全敏感的信息(如密码)就不会作为连接的一部分返回。重置连接字符串将重置包括密码在内的所有连接字符串值。 | 
| Unicode | 指定用于 Oracle 的.NET Framework 数据提供程序是否使用 UTF16 模式 API 调用。除了未在 Oracle 9i 客户端软件中使用分布式事务的情况以外,该关键字在其他情况下都会被忽略。当不使用 Oracle 9i 客户端软件与 Oracle 9i 服务器通信时,如果 Unicode 设置为 true,可能发生不可预知的结果。 | |
| 用户 ID | Oracle 登录帐户(建议不要使用。为了保持较高的安全级别,极力建议您改用集成安全性关键字。) | 
当设置需要布尔值的关键字或连接池值时,您可以使用 'yes' 代替 'true','no' 代替 'false'。整数值表示为字符串。
示例
[Visual Basic, C#, C++] 下面的示例创建一个 OracleConnection,并在连接字符串中设置它的一些属性。
}
所以说,用.NET新提供的managed provider来访问Oracle数据(System.Data.OracleClient),是无法以sys用户登录的。这只有使用Oracle ODP.NET(可以去oracle官方网站下载)
Oracle ODP.NET数据库访问连接字符串
| Connection String Attribute | 默认值  | 描述  | 
| Connection Lifetime  | 0  | Maximum life time (in seconds) of the connection  当数据库连接被返回到连接池中时,它的创建时间将与当前时间比较,如果超过了 Connection Lifetime 规定的时间,它将被释放掉。 为 0 时将被视为最大连接时间。  | 
| Connection Timeout  | 15  | Maximum time (in seconds) to wait for a free connection from the pool  | 
| Data Source  | empty string  | Oracle Net Service Name that identifies the database to connect to  | 
| DBA Privilege  | empty string  | Administrative privileges: SYSDBA or SYSOPER  | 
| Decr Pool Size  | 1  | Controls the number of connections that are closed when an excessive amount of established connections are unused  | 
| Enlist  | true  | Enables or disables serviced components to automatically enlist in distributed transactions  当此值为 true 时,池中现存的所有数据库连接将被加入到它的创建线程的 Transaction Context 中。如果不存在这个 Transaction Context 则无任何变化。  | 
| Incr Pool Size  | 5  | Controls the number of connections that are established when all the connections in the pool are used  | 
| Max Pool Size  | 100  | Maximum number of connections in a  pool  | 
| Min Pool Size  | 1  | Minimum number of connections in a pool  | 
| Password  | empty string  | Password for the user specified by User Id  | 
| Persist Security Info  | false  | Enables or disables the retrieval of password in the connection string  | 
| Pooling  | true  | Enables or disables connection pooling  | 
| Proxy User Id  | empty string  | User name of the proxy user  | 
| Proxy Password  | empty string  | Password of the proxy user  | 
| User Id  | empty string  | Oracle user name  | 
// C# 
... 
OracleConnection con = new OracleConnection(); 
con.ConnectionString = "User Id=scott;Password=tiger;Data Source=oracle;
Pooling=true;Enlist=true;Min Pool Size=10;Connection Lifetime=120;
Connection Timeout=60;Incr Pool Size=5; Decr Pool Size=2"; 
con.Open(); 
... 
以下网站提供连接字符串大全: 
                                关键字词:
                        
                        
                        
                    

 
                    