J
John Smith
I want to be able to browse an LDAP directory (Active Directory) and bring
back the names of users and servers. I can connect to the active directory
server and get authenticated, but how do I construct a query to browse for
information I have tried:
LdapContext context = new InitialLdapContext(env,null);
NamingEnumeration e = context.search("cn=,ou=,o=",null);
while (e.hasMoreElements()) {
Object o = e.nextElement();
System.out.println(o.getClass().getName()+" "+o.toString());
}
But just get:
Exception in thread "main" javax.naming.InvalidNameException: cn=,ou=,o=:
[LDAP: error code 34 - 0000208F: NameErr: DSID-031001BA, problem 2006
(BAD_NAME), data 8350, best match of:
'cn=,ou=,o='
Thanks
Jon
back the names of users and servers. I can connect to the active directory
server and get authenticated, but how do I construct a query to browse for
information I have tried:
LdapContext context = new InitialLdapContext(env,null);
NamingEnumeration e = context.search("cn=,ou=,o=",null);
while (e.hasMoreElements()) {
Object o = e.nextElement();
System.out.println(o.getClass().getName()+" "+o.toString());
}
But just get:
Exception in thread "main" javax.naming.InvalidNameException: cn=,ou=,o=:
[LDAP: error code 34 - 0000208F: NameErr: DSID-031001BA, problem 2006
(BAD_NAME), data 8350, best match of:
'cn=,ou=,o='
Thanks
Jon