Scott Baker
Scott Baker

Reputation: 10443

Transforming an LDAP connection string to an Oracle ODP.NET Managed web.config <LDAPSettings />

The not-very-patient DBA in my group has given me a string similar to the following as my LDAP connection string -

jdbc:oracle:thin:@ldap:/oidAAA.ourdomain.com:4444/foo,cn=OracleContext,dc=bardb

And according to the Oracle Documentation:

For OID, all ldap.ora parameters must be set with valid values to complete configuration.

I have found a list of "all ldap.ora parameters" but I've yet to deduce which parts of the above connection string map to which parameters.

Thanks to some help from the DBA, I've been able to determine the following:

<LDAPSettings>
  <LDAPSetting name="DIRECTORY_SERVERS" value="oidAAA.ourdomain.com:4444" />
  <LDAPSetting name="DIRECTORY_SERVER_TYPE" value="OID" />
  <LDAPSetting name="DEFAULT_ADMIN_CONTEXT" value="bardb" />
</LDAPSettings>

The question I have now is how to actually USE this. Assuming my database is "foo" how do I use ODP.NET to resolve this?

Any assistance would be greatly appreciated.

Upvotes: 0

Views: 3564

Answers (1)

mzoellner
mzoellner

Reputation: 11

I assume you have enabled the config parsing

<configuration>
  <configSections>
    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=[...], Culture=neutral, PublicKeyToken=[...]"/>
[...]

Now you need to specify your connection string

<configuration>
  <connectionStrings>
    <add name="myFooConnection" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=[...];Password=[...];Data Source=foo"/>

Note the Data Source=foo part. It uses the configured TNS, LDAP etc. to resolve the connection.

You can reference the connection by name myFooConnection with compatible ASP.Net controls or directly pass the connection string to an Oracle.ManagedDataAccess.Client.OracleConnection

VB.Net:

Dim connectionString As String = System.Configuration.ConfigurationManager.ConnectionStrings("myFooConnection").ConnectionString
Dim connection As New Oracle.ManagedDataAccess.Client.OracleConnection(connectionString)

Upvotes: 1

Related Questions