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.Text.Trim (), TxtDBPassword.Text.Trim ());
This approach does not require the addition of link configuration information in Oracle Net Manager management.
2.2. Configure link mode,
Add the link configuration information in Oracle Net Manager management, and then link the string to the following notation:
Data SOURCE=TORCL; User Id=myusername; Password=mypassword;
Other ways of connecting, 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, free release version.
The following are 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 syntax formats: Driver={microsoft ODBC for Oracle}; server=myserveraddress; Uid=myusername; Pwd=mypassword; |
Old version Connection mode
The following are 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 syntax formats: Provider=msdaora;data Source=myoracledb; User Id=myusername; Password=mypassword; |
Trusting connections
The following are syntax formats: Provider=msdaora;data Source=myoracledb; Persist Security info=false;integrated Security=yes; |
Standard secure connection
This connection is using provider from Oracle.
The following are syntax formats: Provider=oraoledb.oracle;data Source=myoracledb; User Id=myusername; Password=mypassword; |
Trusting connections
The following are syntax formats: Provider=oraoledb.oracle;data source=myoracledb;osauthent=1; |
The following are 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 syntax formats: Data SOURCE=TORCL; User Id=myusername; Password=mypassword; |
Connection with integrated security
The following are syntax formats: Data source=torcl;integrated Security=sspi; |
connection with odp.net without Tnsnames.ora
The following are syntax formats: 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
Standard connection
The following are syntax formats: Data source=myoracledb;integrated Security=yes |
Oracle8i Release 3 or later only
Indicates a user's connection to the password
The following are syntax formats: Data Source=myoracledb; User Id=myusername; Password=mypassword;integrated Security=no; |
This is another way of connecting without your dns.you create a connection string based on the format used in the Tnsnames.ora file without the need to act Ually have one of these files on the client PC.
The following are 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 ' ve encountered problems.
The following are 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 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 syntax formats: Data Source=myoracledb; User id=/; |
Privileged connections
privileges to use Sysoper
The following are 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 to set the new password.
The following are syntax formats: Data Source=myoracledb; User Id=myusername; Password=mypassword;
Oconn.openwithnewpassword (Sthenewpassword); |
Proxy authentication
The following are 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 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 syntax formats: PROVIDER=MSDATASHAPE.1; Persist security Info=false;data Provider=msdaora;data Source=orac; User Id=myusername; Password=mypassword; |