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      ( 2.5.4.11 NAME (  'ou' 'organizationalUnitName' ) DESC 'Standard LDAP attribute type' SUP 'name' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
objectClass      ( 2.5.4.0 NAME 'objectClass' DESC 'Standard LDAP attribute type' EQUALITY 'objectIdentifierMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256 (XXX: syntax should be ...38)' )

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

cn
affiliations
streetaddress
phone
fax
etc

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

Thanks!

==============================

SOLUTION:

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