tags:

views:

69

answers:

3

I want to make a web based Java application that reads an LDAP compliant directory and creates a record in a database for each user and group in the directory.

How can i go about it?

A: 

I don't see how being web-based will affect things, so long as the web server has access to the LDAP directory - you'd use classes under javax.naming.

If you want to access a directory which the browser has access to but not the web server, you'll need to write code to run on the client instead - possible a JNLP application with appropriate access to make network connections.

Jon Skeet
+1  A: 

I've used the Spring LDAP module to interact with directories. It works very well, same as all Spring code. You would use whatever relational database technology you wish to write to the database. If you're already using Spring, this won't be difficult. In this case you'd create a connection to an LDAP to read the data and another to the database to write it.

But there's a question here that's worth asking: Why do you feel like you need to duplicate the data? The DRY principle would discourage you from doing so. Wouldn't it be better to have all the information in one place or the other?

duffymo
A: 

The general API for talking to directory services (including LDAP) in Java is JNDI (javax.naming).

The official documentation for LDAP is rubbish, but there's a good tutorial on JavaWorld here.

skaffman