Oracle connection string without tnsnames.ora file

71,169

Solution 1

http://www.connectionstrings.com/oracle

This is a great resource

SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))
(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));uid=myUsername;pwd=myPassword;

is what you want i believe...

Solution 2

Starting with 10g clients, you can use the EZCONNECT feature, which does not require to edit the TNSNAMES.ORA file : username/password@servername:port/instance. For instance :

Data Source=localhost:1521/XE;Persist Security Info=True;User ID=scott;Password=tiger;Unicode=True
Share:
71,169
410
Author by

410

Updated on November 02, 2020

Comments

  • 410
    410 over 3 years

    I am using the .NET framework with the System.Data.OracleClient namespace. I have the oracle 11 client installed on my computer. I do not want to use the tnsnames.ora file to store connection information.

    Could someone please tell me what the connection string would look like if I did not want to use the tnsnames.ora file? I will be storing the connection string in a web.config file of a Web Application Project.

  • AndrewS
    AndrewS over 11 years
    It should be: "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(POR‌​T=MyPort))(CONNECT_D‌​ATA=(SERVICE_NAME=My‌​OracleSID)));User ID=myUsername;Password=myPassword;"
  • Johny
    Johny over 2 years
    Oh thank you thank you!