0

For some reason I have to include an LDAP.ORA file inside my .NET project when attempting to connect to Oracle with LDAP. From my understanding of using the Oracle.ManagagedDataAccess nuget package I should be able to contain everything within the web.config. Documentation from Oracle is located here and a useful walk through is provided here. I am guessing that one of my configuration properties is slightly off, but I haven't been able to track it down. Any help would be much appreciated!

Oracle Configuration Section

  <oracle.manageddataaccess.client>
    <version number="*">
      <LDAPsettings>
        <LDAPsetting name="DIRECTORY_TYPE" value="OID" />
        <LDAPsetting name="DEFAULT_ADMIN_CONTENT" value="dc=mycompany,dc=net"/>
        <LDAPsetting name="DIRECTORY_SERVERS" value="(myoid.mycompany.net:1389:1636)" />
      </LDAPsettings>
      <settings>
        <setting name="NAMES.DIRECTORY_PATH" value="(LDAP)"/>
        <setting name="NAMES.DEFAULT_DOMAIN" value="mycompany"/>
      </settings>
    </version>
  </oracle.manageddataaccess.client>

Oracle Connection String

<add name="MyDatabase" providerName="Oracle.ManagedDataAccess.Client" connectionString="Data Source=MyDatabase; User Id=MyUser; Password=MyPassword;" />

Connection Code

private DbConnection GetConnection()
{
    var connectionStringSettings = ConfigurationManager.ConnectionStrings["MyDatabase"];
    var connection = new OracleConnection(connectionStringSettings.ConnectionString);
    connection.Open();
    return connection;
}
Blake Blackwell
  • 7,575
  • 10
  • 50
  • 67
  • There is a bug when ODP.NET Managed Driver used LDAP to resolve the TNS alias, see here: http://stackoverflow.com/questions/30905910/odp-net-managed-library-does-resolve-alias-but-32-bit-library-does/30920849 Perhaps this is related to your problem. – Wernfried Domscheit Mar 22 '16 at 21:33

1 Answers1

0

I think

<LDAPsetting name="DIRECTORY_TYPE" value="OID" />
<LDAPsetting name="DEFAULT_ADMIN_CONTENT" value="dc=mycompany,dc=net"/>

must be replaced by

<LDAPsetting name="DIRECTORY_SERVER_TYPE" value="OID" />
<LDAPsetting name="DEFAULT_ADMIN_CONTEXT" value="dc=mycompany,dc=net"/>

I am not sure but I assume when your default context is dc=mycompany,dc=net, then your NAMES.DEFAULT_DOMAIN has to be mycompany.net.

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110