• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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() );
}
}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic