Is there a way in Java to do a Nslookup search on SRV records?
I need to bind to Active Directory and would like to use the SRV records to help determine which of the ADs in the cluster are live.
In command line the nslookup search string is: ‘nslookup -type=srv _ ldap._tcp.ActiveDirectory domain name’
Thanks.
As erickson pointed out, the JNDI API has a provider for DNS using JNDI, which you can read up about on that link. For a working sample query the
_ldap._.tcp.mydomain.comrecord, see this code from Hudson.I believe that before utilizing the DNS provider, you need to load it with something like this (modified from the Hudson code above):
from there you, can obtain the SRV record via something like:
I’ve successfully managed to use code like this in a couple of projects for very straight-forward AD integration.