Oracle's OID Service, Oracle.DataAccess and connection strings

Scott Ross picture Scott Ross · Jan 7, 2011 · Viewed 7.6k times · Source

I am looking to understand how to implement an OID connection string in .Net using the Oracle.DataAccess.dll .

The OID connection string is in this format: ldap://servname:389/instance,cn=OracleContext

When I use this as my datasource, I receive this error: ..is an invalid connection string attribute

What is the format to connect to Oracle's OID?

Thank you, Scott

Answer

Codo picture Codo · Jan 7, 2011

Oracle's idea is to configure the LDAP server (OID in your case) in the LDAP.ORA file in the TNS Admin directory (usually $ORACLE_HOME/network/admin). There you have something like:

DIRECTORY_SERVERS = (servname:389)
DEFAULT_ADMIN_CONTEXT = "dc=company,dc=com"
DIRECTORY_SERVER_TYPE = OID

You might also need to adapt the SQLNET.ORA file:

NAMES.DIRECTORY_PATH= (LDAP, TNSNAMES)

Then your connection string is just:

Data Source=instance; User ID=scott; Password=tiger

(or even without user ID and password).

Update:

If you cannot change the TNS Admin directory, the only option I know of is to use connection strings containing all the details (server name, port, SID or service name). There are three formats:

TNS syntax:

Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=serername)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=instanceSID))); User ID=scott; Password=tiger

EZ Connect with a service name (note the single slashe between the server name and the service name):

Data Source=//servername:1521/servicename; User ID=scott; Password=tiger

EZ Connect with an SID (note the double slashes between the server name and the SID):

Data Source=servername:1521//instanceSID; User ID=scott; Password=tiger