Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

EntityFramework LDAP connection - model built from DB but cannot resolve TNS

Reuben CoOct 31 2024

This is using .Net Framework 4.8.

I was finally able to build an Entity Framework model using database first using an LDAP connection. I made sure that Oracle Managed Data Access, Oracle Managed Data Access Entity Framework, and the Oracle Developer Tools for Visual Studio 2022 all are using version 21.

As I'm using the Managed client, I wanted to avoid any settings that refer to external files. I was able to include ldap details as well as the connection into my app.config.

When I try to use the model, I get the following error: ORA-12154: TNS:could not resolve the connect identifier specified from system.data.entity.core.EntityException (not using Core). That doesn't make sense as I was able to create the model from it.

<configSections>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.21.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
<connectionStrings>
  <add name="Databridge" providerName="Oracle.ManagedDataAccess.Client" connectionString="Data Source=oracleserver;password=tiger;User ID=scott" />    
<add name="DatabridgeEntities" connectionString="metadata=res://*/DataWarehouse.csdl|res://*/DataWarehouse.ssdl|res://*/DataWarehouse.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=oracleserver;PASSWORD=tiger;PERSIST SECURITY INFO=True;USER ID=scott&quot;" providerName="System.Data.EntityClient" />
 </connectionStrings>
 <entityFramework>
    <defaultConnectionFactory type="Oracle.ManagedDataAccess.EntityFramework.OracleConnectionFactory, Oracle.ManagedDataAccess.EntityFramework">
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.21.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </providers>
  </entityFramework>
  <oracle.manageddataaccess.client>
    <version number="*">
      <LDAPsettings>
        <LDAPsetting name="DIRECTORY_SERVERS" value="(ldapserver1.domain.com:3060,ldapserver2.domain.com:3060" />
        <LDAPsetting name="DIRECTORY_SERVER_TYPE" value="oid" />
        <LDAPsetting name="DEFAULT_ADMIN_CONTEXT" value="dc=domain,dc=com" />
      </LDAPsettings>
      <settings>
        <setting name="NAMES.DIRECTORY_PATH" value="(LDAP)" />
Comments
Post Details
Added on Oct 31 2024
1 comment
62 views