• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ldap jndi mapping

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic