Fog Creek Software
g
Discussion Board




LDAP and Java

Does any poster have tips on where to find info on creating LDAP access with a Java application; either online or book?

Google did not come up with much. Some of the info were too theoretical- i.e. management stuff .

Thanks.

Ram Dass
Tuesday, September 30, 2003

http://java.sun.com/products/jndi/
(part of JDK 1.4+)

Rhys Keepence
Tuesday, September 30, 2003

Netscape has a ldap jdk that can do almost anything you want to with ldap.  Look for ldapjdk.jar and you should be able to find the sdk.  You can start here http://developers.sun.com/sw/docs/examples/appserver/ldap.html

K

K
Tuesday, September 30, 2003

Check out the JNDI tutorial on the Java site - http://java.sun.com/products/jndi/tutorial/

There is a reference directory implementation RefFSContext which you can use to store/retrieve values. If you wanted to store values in the folder /intrant/jndi you'd set up your initial context as follows:


Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
env.put(Context.PROVIDER_URL, "file:///intranet/jndi");

Context ctx = new InitialContext(env);
ctx.bind( "greeting", "Hello" );


If you're trying to connect to ActiveDirectory using LDAP things are a little more complex for one simple reason - ActiveDirectory supports the LDAP protocol (i.e. you can use LDAP to query AD), but not LDAP conventiones (i.e. naming of nodes, locating nodes is different in AD).

Walter Rumsby
Tuesday, September 30, 2003

http://pegacat.com/jxplorer/

Juha
Wednesday, October 1, 2003

www.openldap.org/jldap/

This works fine for me.

fw
Wednesday, October 1, 2003

Good book:

Rob Weltman, Tony Dahbura:
LDAP Programming with Java

Annette Sündermann
Thursday, October 2, 2003

*  Recent Topics

*  Fog Creek Home