Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ldap jndi mapping  RSS feed

 
Harjot Narula
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am importing some user information from ldap server to my database.
I have connected to the LDAP server using jndi and am able to extract the meta data of the server(attributes). I want to update my database time to time. All the users which are not present in the database (but present in the LDAP server) should be added in the database. I dont know how to keep track of which users are present in the database already, cause I dont want duplicate rows in database table. Can you help me ?
I think if I am able to keep track of some key in LDAP server by which I can distinguish between different records, I will be able to solve the problem.
Harjot
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you're looking into having a batch process type of application, which runs through all records in LDAP and adds them into the database if not already there?
Here's the simplest approach I can think of (unless your LDAP directory has some LDAP-to-database synchronization feature):
1) Get a list of all user records from LDAP
2) Iterate through the list in your Java code, and for each "User" object do the following:
2.1) Try to SELECT from the database based on the LDAP user's username
2.2) If not found from the database, make an INSERT. If found, skip to next user.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!