aspose file tools*
The moose likes Security and the fly likes LDAP connection  close Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "LDAP connection  close" Watch "LDAP connection  close" New topic
Author

LDAP connection close

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1378
How shall i close the LDAP connection ? i am using Netscape Directory server.
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
I guess closing the ldap initial context s'd suffice.
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1378
Any update ?
sherjeelmd ghouse
Greenhorn

Joined: Nov 17, 2005
Posts: 7
Call the close on DirContext.

Here is the code. Connection pooling might be helpful for you.

Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");

// Enable connection pooling
env.put("com.sun.jndi.ldap.connect.pool", "true");

// Create one initial context (Get connection from pool)
DirContext ctx = new InitialDirContext(env);

// do something useful with ctx

// Close the context when we're done
ctx.close(); // Return connection to pool


Sherjeel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LDAP connection close