Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle connection string without tnsnames.ora file

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.

like image 650
410 Avatar asked May 04 '09 14:05

410


People also ask

Where can I find connection string in Oracle?

Privileged Connections Oracle allows database administrators to connect to Oracle Database with either SYSDBA or SYSOPER privileges. Data Source=myOracle;User Id=myUsername;Password=myPassword;DBA Privilege=SYSDBA; SYSOPER is also valid for the DBA Privilege attribute.

Where is Tnsnames Ora file located?

By default, the tnsnames. ora file is located in the ORACLE_HOME/network/admin directory.

What is Oracle Tnsnames Ora?

ORA is a SQL*Net configuration file that defines databases addresses for establishing connections to them. This file normally resides in the ORACLE HOME\NETWORK\ADMIN directory, but location can be defined by the TNS_ADMIN environment variable.


2 Answers

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
like image 120
Mac Avatar answered Oct 25 '22 02:10

Mac


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...

like image 27
Gordon Thompson Avatar answered Oct 25 '22 02:10

Gordon Thompson