Referencing LDAP for JDBC thin client connections….

Just a quick note, to mention something that I just recently discovered.  (Yes, this has been available since at least Oracle 10.1, but I wasn’t aware of it!)

When composing a JDBC thin client connect URL, we have been using something of the form:
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOSTNAME=myhost.my.domain)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=mydb)))

This is fine, but if you have a mix of Oracle OCI clients and JDBC thin clients, and if the OCI clients are all configured to use an LDAP server for Net Service Name resolution, then, whenever you make any kind of reconfiguration, you need to update the LDAP server, and then still need to update the hardcoded connection information in the JDBC Thin URL.

However, what i recently discovered, is that it's possible to define your JDBC Thin URL, thus:

jdbc:oracle:thin:@ldap://my.ldap.server.my.domain:389/mydb,cn=OracleContext,dc=my,dc=domain

So, now, the JDBC Thin connection will refer to the LDAP server for info on the 'mydb' connect string, and the LDAP server will return:

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOSTNAME=myhost.my.domain)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=mydb)))

And now, when I update my centrally managed LDAP server, it's seen by all my JDBC Thin clients as well as OCI clients.

So, yes, this has been around for many years, but I wasn't aware of it. I'm sure you, my readers, are much sharper than I, and have known about it all along, and are saying "So, what's new? What's he going on about?" But, perhaps there are one or two that were not aware of this, so, I hope this little mini-blog entry helps someone out!

Thanks to Fred for this comment on my OpenLDAP blog post, that brought this to light for me:

http://markjbobak.wordpress.com/2013/10/08/using-openldap-for-net-service-name-resolution/#comment-60

About these ads

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s