Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what's the difference between java sdk and ms outlook when connecting to ldap?

 
chris
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i'm not sure it's ok to ask a question about ldap itself(not related to security....), but please excuse..

i have a ldap server address using in my ms outlook.
i just put a server address (such as xxx.xxx.xxx ),
and it works nicely searching emails, names.....

what i wanna do is to connect to the ldap server using my java application.
same server address. nothing else..
but it does not work. it gives me exception saying "No Such Object"!
i guess it refers to "ou=people" .
do i have to give more information to java??
does the ms outlook have some specific default setting??
please help..

code as following:
LDAPConnection ld = null;
LDAPEntry findEntry = null;
LDAPSearchResults res = null;
int dn_count=0;
try {
ld = new LDAPConnection();
String MY_HOST = "xxx.xxx.xxx";
int MY_PORT = 389;
ld.connect( MY_HOST, MY_PORT );
String MY_SEARCHBASE = "ou=people";
String MY_FILTER = "objectclass=*";
LDAPSearchConstraints cons = ld.getSearchConstraints();
cons.setBatchSize(0);
res = ld.search( MY_SEARCHBASE,LDAPConnection.SCOPE_SUB,MY_FILTER,null,false,cons);
System.out.println( "AUTO Count : " + res.getCount() );
} catch( LDAPException e ) {
e.printStackTrace();
}
while ( res.hasMoreElements() ) {
try {
findEntry = res.next();
dn_count++;
} catch ( LDAPException e ) {
e.printStackTrace();
}
}
System.out.println( "MANUAL Count : " +dn_count);
if ( (ld != null) && ld.isConnected() ) {
try {
ld.disconnect();
} catch ( LDAPException e ) {
System.out.println( "Error: " + e.toString() );
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic