Two ways: 1. Ip+sid Mode 2. Configure link mode
1..ip+sid Way
Dbhelperoracle.connectionstring =string. Format (@"Data source= (DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = {0}) (PORT = 1521)) ) (Connect_data = (SID = {1}) (SERVER = dedicated) ) ); User id={2}; PASSWORD={3};", TxtDBServerIP.Text.Trim (), TxtOracleSID.Text.Trim (), Txtdbusername.tex T.trim (), TxtDBPassword.Text.Trim ());
This approach does not require the addition of link configuration information in Oracle Net Manager management.
2.2. Configure the link mode,
Add the link configuration information in Oracle Net Manager management, and then link the string as follows:
Data SOURCE=TORCL; User Id=myusername; Password=mypassword;
Other ways to connect, refer to the following, from other websites:
Oracle Connection String Summary
Oracle XE
Standard connection
Oracle XE (or "Oracle Database 10g Express Edition") is a simple and free release.
The following are the syntax formats: Driver=(Oracle in xeclient); DBQ=111.21.31.99:1521/xe; Uid=myusername; Pwd=MyPassword; |
Odbc
New version Connection mode
The following are the syntax formats: driver={microsoft ODBC for Oracle}; server=myserveraddress; Uid=myusername; Pwd=mypassword; |
Old version Connection mode
The following are the syntax formats: driver={microsoft ODBC Driver for Oracle}; Connectstring=oracleserver.world; Uid=myusername; Pwd=mypassword; |
OLE DB, OleDbConnection (. NET)
Standard secure connection
This connection is using provider from Microsoft.
The following are the syntax formats: Provider=msdaora;data Source=myoracledb; User Id=myusername; Password=mypassword; |
Trust connection
The following are the syntax formats: Provider=msdaora;data Source=myoracledb; Persist Security info=false;integrated Security=yes; |
Standard secure connection
This connection uses the provider from Oracle.
The following are the syntax formats: Provider=oraoledb.oracle;data Source=myoracledb; User Id=myusername; Password=mypassword; |
Trust connection
The following are the syntax formats: Provider=oraoledb.oracle;data source=myoracledb;osauthent=1; |
The following are the syntax formats: provider=oraoledb.oracle;data source= (description= (Cid=gtu_app) (Address_list= (address= (PROTOCOL=TCP) (HOST= MyHost (Port=myport))) (Connect_data= (SID=MYORACLESID) (server=dedicated))); User Id=myusername; Password=mypassword; |
Oracle.DataAccess.Client.OracleConnection
Standard connection
The following are the syntax formats: Data SOURCE=TORCL; User Id=myusername; Password=mypassword; |
Connection with integrated security
The following are the syntax formats: Data source=torcl;integrated Security=sspi; |
connection with odp.net without Tnsnames.ora
The following are the syntax formats: Data source= (description= (address_list= (address= (protocol=tcp) (Host=myhost)) (Port=myport) ( server=dedicated) (SERVICE_NAME=MYORACLESID)); User Id=myusername; Password=mypassword; |
OracleConnection, Oracle Data Provider, Odp.net, System.Data.OracleClient.OracleConnection
Standard connection
The following are the syntax formats: Data Source=myoracledb; Integrated Security=Yes |
Only in Oracle8i Release 3 or later
Indicates the user secret connection to the password
The following are the syntax formats: Data Source=myoracledb; User Id=myusername; password=mypassword;integrated Security=no; |
This is another way to connect without relying on your dns.you create a connection string based on the format used in the Tnsnames.ora file without the need to act Ually has one of the these files on the client PC.
The following are the syntax formats: server= (description= (address= (protocol=tcp) (Host=myhost) (Port=myport) (connect_data=) (service_name= MYORACLESID)); Uid=myusername;pwd=mypassword; |
Some reported problems with the one above and Visual Studio. Use the next one if you ' ve encountered problems.
The following are the syntax formats: Data source= (description= (address= (protocol=tcp) (Host=myhost) (Port=myport)) (Connect_data= (service_name= (MYORACLESID))); User Id=myusername; Password=mypassword; |
Using connection pooling
Connection Pooling Service If you cannot find a connection that exactly matches the connection string, he will create one. If the connection can be found, it will be reused.
The following are the syntax formats: 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 authentication
The following are the syntax formats: Data Source=myoracledb; User id=/; |
Privileged connections
privileges to use Sysoper
The following are the syntax formats: Data Source=myoracledb; User Id=sys; PASSWORD=SYS;DBA Privilege=sysoper; |
Using the password termination function
When the connection is opened for the first time, a password expiration error is thrown when the link is opened, capturing the error and executing the Openwithnewpassword command line setting the new password.
The following are the syntax formats: Data Source=myoracledb; User Id=myusername; Password=mypassword;
Oconn.openwithnewpassword (Sthenewpassword); |
Agent Authentication
The following are the syntax formats:
Data Source=myoracledb; User Id=myusername; Password=MyPassword; Proxy User Id=Puserid; Proxy Password=Ppassword; |
|
Core Labs oradirect (. NET)
Standard connection
The following are the syntax formats: User Id=myusername; Password=mypassword; Host=ora; Pooling=true; Min Pool size=0; Max Pool size=100; Connection lifetime=0; |
Data Shape
MS Data Shape
The following are the syntax formats: provider=msdatashape.1; Persist Security info=false;data provider=msdaora;data Source=orac; User Id=myusername; Password=mypassword; |