I had connected to oracledb with nodejs with hostname and servicename and it was working fine with below syntax:
connection =await oracledb.getConnection({
user: 'username',
password: 'pwd',
connectString: 'hostname:port/servicename'
});
Our database details recently changed to LDAP connectivity and I have hence updated the connectString as below:
connection =await oracledb.getConnection({
user: 'username',
password: 'pwd',
connectString:'jdbc:oracle:thin:@ldap://<LDAP Server>:port/<Database Service Name>,cn=OracleContext,dc=<domain>,dc=com'
});
However I get error: ORA -12154:TNS could not resolve the connect identifier specified
I checked with our DBA and they do not use ORA files and neither did I have those before in my network/admin folder. Do I still need to add the same. I am new to Oracle DB and I did not find resolutions which helped me on this and hence posting the issue. Appreciate any help.
CodePudding user response:
jdbc is Java - not node.js (which is JavaScript)
Try
{
user: 'username',
password: 'pwd',
connectString:'<Database Service Name>'
}
You must configure the LDAP settings in ldap.ora
file, for example like this:
DEFAULT_ADMIN_CONTEXT = "dc=<domain>,dc=com"
DIRECTORY_SERVERS = (<LDAP Server>:port)
DIRECTORY_SERVER_TYPE = OID
and set it also in sqlnet.ora
:
NAMES.DEFAULT_DOMAIN = <domain>.com
NAMES.DIRECTORY_PATH = (LDAP, TNSNAMES)
SQLNET.INBOUND_CONNECT_TIMEOUT = 10