下面這個網頁收集了基本上所有的數據庫的連結字串的寫法,轉帖上oracle的部份,其它請參考原文章
Oracle ODBC OLE DB, OleDbConnection (.NET) OracleConnection (.NET) Core Labs OraDirect (.NET) Data Shape
Oracle ODBC OLE DB, OleDbConnection (.NET) OracleConnection (.NET) Core Labs OraDirect (.NET) Data Shape
- New version:
"Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;Uid=Username;Pwd=asdasd;" - Old version:
"Driver={Microsoft ODBC Driver for Oracle};ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;"
- Standard security:
"Provider=msdaora;Data Source=MyOracleDB;User Id=UserName;Password=asdasd;"This one's from Microsoft, the following are from Oracle
- Standard Security:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=Username;Password=asdasd;" - Trusted Connection:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;"
- Standard:
"Data Source=MyOracleDB;Integrated Security=yes;"This one works only with Oracle 8i release 3 or later
- Specifying username and password:
"Data Source=MyOracleDB;User Id=username;Password=passwd;Integrated Security=no;"This one works only with Oracle 8i release 3 or later
- Declare the OracleConnection:
C#:
using System.Data.OracleClient;
OracleConnection oOracleConn = new OracleConnection();
oOracleConn.ConnectionString = "my connectionstring";
oOracleConn.Open();VB.NET:
Imports System.Data.OracleClient
Dim oOracleConn As OracleConnection = New OracleConnection()
oOracleConn.ConnectionString = "my connectionstring"
oOracleConn.Open()
Missing the System.Data.OracleClient namespace? Download .NET Managed Provider for Oracle >>
Great article! "Features of Oracle Data Provider for .NET" by Rama Mohan G. at C# Corner
- Standard:
"User ID=scott; Password=tiger; Host=ora; Pooling=true; Min Pool Size=0;Max Pool Size=100; Connection Lifetime=0"Read more at Core Lab and the product page.
- MS Data Shape:
"Provider=MSDataShape.1;Persist Security Info=False;Data Provider=MSDAORA;Data Source=orac;user id=username;password=mypw"Want to learn data shaping? Check out 4GuyfFromRolla's great article about Data Shaping >>
原文章出處 http://www.connectionstrings.com/
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29987/viewspace-51807/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29987/viewspace-51807/