Fetching LDAP Schema in Java – Education Career Blog

I’m trying to fetch the schema of an LDAP entity. I’ve been advised to use Novell’s open sourced LDAP library, which seems to be quite good. I found an example called GetAttributeSchema, which sounds really good, but I think I’ve got a parameter set incorrectly or something.

The results I’m getting are:

 ou      ( NAME (  'ou' 'organizationalUnitName' ) DESC 'Standard LDAP attribute type' SUP 'name' SYNTAX X-ORIGIN 'RFC 2256' )
objectClass      ( NAME 'objectClass' DESC 'Standard LDAP attribute type' EQUALITY 'objectIdentifierMatch' SYNTAX X-ORIGIN 'RFC 2256 (XXX: syntax should be ...38)' )

The results I’m expecting are something to the effect of:


Just wondering if it’s obvious to an LDAP expert what I’m missing or what I should be asking for.




ServiceableLDAPConnection lc = takeConnection();
LDAPSchema schema = lc.fetchSchema(lc.getSchemaDN());
Enumeration<?> enumeration = schema.getAttributeNames();

I found this site particularly useful: http://www.go4expert.com/forums/showthread.php?t=4814



You are getting the full schema definitions. Usually in LDAP queries for cn=schema, you get the entire schema as one object you will need to parse.

Leave a Comment