Data Source=TORCL;User Id=myUsername;Password=myPassword;
带integrated security的连接
以下是语法格式:
Data Source=TORCL;Integrated Security=SSPI;
带 ODP.NET 不带 tnsnames.ora的连接
以下是语法格式:
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;
OracleConnection, Oracle Data Provider, ODP.NET, System.Data.OracleClient.OracleConnection
标准连接
以下是语法格式:
Data Source=MyOracleDB;Integrated Security=yes
仅在Oracle8i release 3 或更高版本
指明用户密与密码的连接
以下是语法格式:
Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;Integrated Security=no;
这是另一种连接方式不依赖你的DNS.You create a connection string based on the format used in the tnsnames.ora file without the need to actually have one of these files on the client pc.
Some reported problems with the one above and Visual Studio. Use the next one if you've encountered problems.
以下是语法格式:
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;
使用连接池
连接池服务如果找不到一个完全匹配连接字符串的连接,他将会创建一个。如果能找到该连接,将会重新使用。
以下是语法格式:
Data Source=myOracleDB;User Id=myUsername;Password=myPassword;Min Pool Size=10;Connection Lifetime=120;Connection Timeout=60;Incr Pool Size=5;Decr Pool Size=2;
Windows验证
以下是语法格式:
Data Source=myOracleDB;User Id=/;
特权连接
使用SYSOPER的特权
以下是语法格式:
Data Source=myOracleDB;User Id=SYS;Password=SYS;DBA Privilege=SYSOPER;
把配置写到连接字符串上就不用配置了
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=*.*.*.*)(PORT=1521)))(CONNECT_DATA=(sid =****)));User Id=****;Password=****