ODBC
New version
Driver={Microsoft ODBC for Oracle};Server=myServerAddress;Uid=myUsername;Pwd=myPassword;
COPY TO CLIPBOARD
Old version
Driver={Microsoft ODBC Driver for Oracle};ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;
COPY TO CLIPBOARD
OLE DB, OleDbConnection (.NET)
Standard security
This connection string uses a provider from Microsoft.
Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;
COPY TO CLIPBOARD
Trusted connection
Provider=msdaora;Data Source=MyOracleDB;Persist Security Info=False;Integrated Security=Yes;
COPY TO CLIPBOARD
Standard Security
This connection string uses a provider from Oracle.
Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;
COPY TO CLIPBOARD
Trusted Connection
Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;
COPY TO CLIPBOARD
OracleConnection, Oracle Data Provider, ODP.NET
Standard
Data Source=MyOracleDB;Integrated Security=yes;
This one works only with Oracle 8i release 3 or later
COPY TO CLIPBOARD
Specifying username and password
Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;Integrated Security=no;
This one works only with Oracle 8i release 3 or later
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 >>
COPY TO CLIPBOARD
Omiting tnsnames.ora
This is another type of Oracle connection string that doesn't rely on you to have a DSN for the connection. 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.
SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));uid=myUsername;pwd=myPassword;
COPY TO CLIPBOARD
Using Connection Pooling
The connection pooling service will create a new pool if it can't find any existing pool that exactly match the new connections connection string properties. If there is a matching pool a connection will be recycled from that pool.
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;
COPY TO CLIPBOARD
Windows Authentication
Data Source=myOracleDB;User Id=/;
COPY TO CLIPBOARD
Privileged Connection
With SYSDBA privileges
Data Source=myOracleDB;User Id=SYS;Password=SYS;DBA Privilege=SYSDBA;
COPY TO CLIPBOARD
Privileged Connection
With SYSOPER privileges
Data Source=myOracleDB;User Id=SYS;Password=SYS;DBA Privilege=SYSOPER;
COPY TO CLIPBOARD
Utilizing the Password Expiration functionality
First open a connection with a connection string. When the connection is opened, an error is raised because the password have expired. Catch the error and execute the OpenWithNewPassword command supplying the new password.
Data Source=myOracleDB;User Id=myUsername;Password=myPassword; oConn.OpenWithNewPassword(sTheNewPassword);
COPY TO CLIPBOARD
Proxy Authentication
Data Source=myOracleDB;User Id=myUsername;Password=myPassword;Proxy User Id=pUserId;Proxy Password=pPassword;
COPY TO CLIPBOARD
Core Labs OraDirect (.NET)
Standard
User ID=myUsername;Password=myPassword;Host=ora;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;
Read more at Core Lab >>
And at the product page >>
COPY TO CLIPBOARD
Data Shape
MS Data Shape
Provider=MSDataShape.1;Persist Security Info=False;Data Provider=MSDAORA;Data Source=orac;User Id=myUsername;Password=myPassword;
Want to learn data shaping? Check out 4GuyfFromRolla's great article about Data Shaping >>
COPY TO CLIPBOARD
挨个试试吧,总有一个适合你.
New version
Driver={Microsoft ODBC for Oracle};Server=myServerAddress;Uid=myUsername;Pwd=myPassword;
COPY TO CLIPBOARD
Old version
Driver={Microsoft ODBC Driver for Oracle};ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;
COPY TO CLIPBOARD
OLE DB, OleDbConnection (.NET)
Standard security
This connection string uses a provider from Microsoft.
Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;
COPY TO CLIPBOARD
Trusted connection
Provider=msdaora;Data Source=MyOracleDB;Persist Security Info=False;Integrated Security=Yes;
COPY TO CLIPBOARD
Standard Security
This connection string uses a provider from Oracle.
Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;
COPY TO CLIPBOARD
Trusted Connection
Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;
COPY TO CLIPBOARD
OracleConnection, Oracle Data Provider, ODP.NET
Standard
Data Source=MyOracleDB;Integrated Security=yes;
This one works only with Oracle 8i release 3 or later
COPY TO CLIPBOARD
Specifying username and password
Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;Integrated Security=no;
This one works only with Oracle 8i release 3 or later
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 >>
COPY TO CLIPBOARD
Omiting tnsnames.ora
This is another type of Oracle connection string that doesn't rely on you to have a DSN for the connection. 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.
SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));uid=myUsername;pwd=myPassword;
COPY TO CLIPBOARD
Using Connection Pooling
The connection pooling service will create a new pool if it can't find any existing pool that exactly match the new connections connection string properties. If there is a matching pool a connection will be recycled from that pool.
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;
COPY TO CLIPBOARD
Windows Authentication
Data Source=myOracleDB;User Id=/;
COPY TO CLIPBOARD
Privileged Connection
With SYSDBA privileges
Data Source=myOracleDB;User Id=SYS;Password=SYS;DBA Privilege=SYSDBA;
COPY TO CLIPBOARD
Privileged Connection
With SYSOPER privileges
Data Source=myOracleDB;User Id=SYS;Password=SYS;DBA Privilege=SYSOPER;
COPY TO CLIPBOARD
Utilizing the Password Expiration functionality
First open a connection with a connection string. When the connection is opened, an error is raised because the password have expired. Catch the error and execute the OpenWithNewPassword command supplying the new password.
Data Source=myOracleDB;User Id=myUsername;Password=myPassword; oConn.OpenWithNewPassword(sTheNewPassword);
COPY TO CLIPBOARD
Proxy Authentication
Data Source=myOracleDB;User Id=myUsername;Password=myPassword;Proxy User Id=pUserId;Proxy Password=pPassword;
COPY TO CLIPBOARD
Core Labs OraDirect (.NET)
Standard
User ID=myUsername;Password=myPassword;Host=ora;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;
Read more at Core Lab >>
And at the product page >>
COPY TO CLIPBOARD
Data Shape
MS Data Shape
Provider=MSDataShape.1;Persist Security Info=False;Data Provider=MSDAORA;Data Source=orac;User Id=myUsername;Password=myPassword;
Want to learn data shaping? Check out 4GuyfFromRolla's great article about Data Shaping >>
COPY TO CLIPBOARD
挨个试试吧,总有一个适合你.
2.配置net configure的服务名
3.数据库名是你配置的服务名
在ORACLE_HOME目录,如c:\Oracle\Ora92
点击鼠标右键->属性->安全,
对ASP.NET 帐户赋予允许读、执行权限,并在“高级”中保证该目录的子目录、文件都继承这些属性,确定。再次启动项目就可以正常运行了。不知是否还有别的方法?