Oracle和C#
求C#连接Oracle的数据库连接程序或连接语句(Oracle数据库在服务器上)本人之熟悉C#和SQL得数据库连接 ,希望哪位仁兄支持一下,先谢过拉!
Oracle
- ODBC
- 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;"
- New version:
- OLE DB, OleDbConnection (.NET)
- 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 security:
- OracleConnection (.NET)
- 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:
- Core Labs OraDirect (.NET)
- 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.
- Standard:
- Data Shape
- 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 >>
- MS Data Shape: