Wednesday, July 24, 2013

Querying Oracle OID LDAP for the real serivce name and TNS details for JDBC

I have a wonderful cloud instance and a database, however on different segments and somehow dear firewall does not allow me to connect...
jdbc:oracle:thin:@ldap://oidprd.gss.mycompany.com:389/fxgdev65,cn=OracleContext,dc=mycompany,dc=com
At the boot of the weblogic server it sends a warning that the targeted jdbc pool cannot create a connection...
     
How to get the TNS name? Ever heard of curl.... thats the way to go (of course you would need openldap libraries loaded... which on my Mac OSX is the case)
$ curl -0 ldap://oidprd.gss.mycompany.com:389/cn=fxgdev65,cn=OracleContext,dc=mycompany,dc=com
DN: cn=fxgdev65,cn=OracleContext,dc=mycompany,dc=com
 objectclass: orclNetService
 objectclass: top

 orclnetdescstring: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=fxgdev65.mycompany.com)(PORT=1527)))(CONNECT_DATA=(SERVICE_NAME=FXGDEV65.MYCOMPANY.COM)(SRVR=DEDICATED)))

 cn: fxgdev65
NOTE: you cannot just use the URI definition of the JDBC url, you need to add the cn= before the service you want to lookup So there you go ... now lets put that after the 'at' sign...
jdbc:oracle:thin://(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=fxgdev65.mycom.com)(PORT=1527)))(CONNECT_DATA=(SERVICE_NAME=FXGDEV65.MYCOMPANY.COM)(SRVR=DEDICATED)))

No comments:

Post a Comment