c#,oracle的连接字符串

来源:互联网 发布:网络歌手冷漠的老婆 编辑:程序博客网 时间:2024/04/25 09:11

c#,oracle的连接字符串

【转】http://blog.163.com/cuisweet/blog/static/1210644020061033105143/

 

System.Data.OracleClient

OracleConnection.ConnectionString 属性

下表为 ConnectionString 内的值列出了有效的名称。

  名称默认值说明数据源或服务器 要连接的oracle实例的名称或网络地址集成安全性'false'该连接是否为安全的连接。

可识别的值为 true(极力建议使用)、falseyesno

密码 Oracle 帐户的登录密码(建议不要使用。为了保持较高的安全级别,极力建议您改用集成安全性关键字。)持续安全信息'false'当设置为 falseno(强烈建议)时,如果连接是打开的或者一直处于打开状态的 State,那么安全敏感的信息(如密码)就不会作为连接的一部分返回。重置连接字符串将重置包括密码在内的所有连接字符串值。Unicode 指定用于 Oracle 的.NET Framework 数据提供程序是否使用 UTF16 模式 API 调用。除了未在 Oracle 9i 客户端软件中使用分布式事务的情况以外,该关键字在其他情况下都会被忽略。当不使用 Oracle 9i 客户端软件与 Oracle 9i 服务器通信时,如果 Unicode 设置为 true,可能发生不可预知的结果。用户 ID Oracle 登录帐户(建议不要使用。为了保持较高的安全级别,极力建议您改用集成安全性关键字。)

 

当设置需要布尔值的关键字或连接池值时,您可以使用 'yes' 代替 'true','no' 代替 'false'。整数值表示为字符串。

 

OracleConnection,并在连接字符串中设置它的一些属性。

 

 

< )); myConnection->DataSource myConnection->ServerVersion, {1}?, {0}/nDataSource: S?ServerVersion: MessageBox::Show(String::Format( myConnection->Open(); OracleConnection(myConnString); myConnection OracleConnection* Security='yes"' Source="Oracle8i;Integrated" myConnString String* { CreateOracleConnection() void public: myConnection.Close();}
<>
所以说,<>System.Data.OracleClient),
是无法以sys用户登录的。
这只有使用Oracle ODP.NET(可以去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 lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: Courier-Oblique; mso-bidi-font-family: Courier-Oblique; mso-font-kerning: 0pt">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();

...

 

以下网站提供连接字符串大全:

www.ConnectionStrings.com

原创粉丝点击