I am trying to code something that will identify duplicate user ids from two different directories. What is the best approach in Java? Do you know any article or online books that would get me up to speed with LDAP programming with Java? Thanks a lot.
The Java API for using LDAP is called JNDI; its home page might be a good starting point for further research.
Ping & DNS - updated with new look and Ping home screen widget
Joined: Sep 10, 2002
Thanks Ulf. I was able to make a successful connection to LDAP via JNDI. I'm a java greenhorn, how can I compare two directories for duplicates say in lastname attribute. I already have the connection to both the directories. Can someone share some codes on how to search thru one attribute and compare with the same attribute on the second directory? Thanks in advance.
how many entries do your directories have? One option would be to fetch all users from directory A, and for each entry make a search for the attributes you interested in on directory B. Check out the JNDI Tutorial at Sun for code examples on how to perform search ops with JNDI. Note that the surname is normally not capable to identify a user, because it tends not to be unique (some serial number would do better).
If your directories contain many entries, this algorithm would be rather slow. It is probably better to export the entries into something else instead of using 2 connections to different directories ... But this depends on how often the task should be performed.
Hope that helped, Stefan
Author of German LDAP-Book
Committer at Apache Directory Project