Connection string for Oracle using Entity Framework and LDAP
To answer if someone else needs it. Solution is relatively simple:
LDAP.ORA file has to be modified with correct LDAP Parameters
DIRECTORY_SERVERS=(tnsnames.somesite.org:389:636)
DEFAULT_ADMIN_CONTEXT="dc=site,dc=com"
DIRECTORY_SERVER_TYPE=OID
and than the connection string is similar to the situation without the LDAP
<connectionStrings>
<add name="VoccDbContext" connectionString="metadata=res://*/Entities.Vocc.VoccModel.csdl|res://*/Entities.Vocc.VoccModel.ssdl|
 res://*/Entities.Vocc.VoccModel.msl;provider=Oracle.DataAccess.Client;provider connection string="DATA SOURCE=sameDbName;PASSWORD=somePass;USER ID=someUser;"" providerName="System.Data.EntityClient" />
</connectionStrings>
Comments
-
Robert Vuković almost 2 years
I have an ASP.NET 4.0 application that is using Entity Framework 4.3 to connect to Oracle database. Connection on a development environment is not a problem because we use the standard method. Connection string was generated by Visual Studio.
Problem is that on production and acceptance environments we have to use LDAP. I have verified connection and can connect using the LDAP from Oracle's SQL Developer.
I need a help with the syntax of connection string in the web.config. How it should look like? I was not be able to find any examples and on production and acceptance I don't have Visual Studio to see if it can generate something automatically.
Update:
I need syntax to change this connection string that is connecting to local Oracle Express to connection string that uses LDAP<connectionStrings> <add name="VoccDbContext" connectionString="metadata=res://*/Entities.Vocc.VoccModel.csdl|res://*/Entities.Vocc.VoccModel.ssdl|res://*/Entities.Vocc.VoccModel.msl;provider=Oracle.DataAccess.Client;provider connection string="DATA SOURCE=localhost:1521;PASSWORD=somePassKey;PERSIST SECURITY INFO=True;USER ID=someUser"" providerName="System.Data.EntityClient" /> </connectionStrings>
-
Robert Vuković over 11 yearsI am not using Windows Authentication. It is some Unix or Oracle LDAP with lots of Oracle databases in it.
-
Bob. over 11 yearsDoes setting a username/password in the connection string affect LDAP? Or does it do LDAP then negate the username/password?
-
Robert Vuković over 11 yearsBecause I am connecting to multiple databases test,acc,prod for each I use different password so by my understanding LDAP only maps database name to specific machine/Oracle instance so it is possible to change Oracle machines without the need to update client connection strings.
-
Sundara Prabu over 9 yearsU also need to have a sqlnet.ora file in the oraclehome folder/network/admin with the following contents.