You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Nick Duan <nd...@dtechspace.com> on 2013/01/29 15:06:58 UTC

JNID vs. Apache DS API - Reconnect to LDAP

One of the problem when using the JNDI API is that it's hard to manage LDAP
connections.   It is common that LDAP servers close connections that have
been idle for a while automatically.   When that happens, you will have to
restart your app server to be able to re-establish the LDAP connection.
There is no straightforward way in JNDI to automatically detect the
connection lost and reestablish the connection automatically, since the LDAP
connection is completely hidden inside the directory context in JDNI.   

 

Is there any simple way to perform status checking on LDAP connections and
reconnect automatically to LDAP using Apache DS API?   Any suggestions/hints
are highly appreciated.

 

ND


Re: JNID vs. Apache DS API - Reconnect to LDAP

Posted by Kiran Ayyagari <ka...@apache.org>.
you can check the return value of isConnected()

On Tue, Jan 29, 2013 at 7:36 PM, Nick Duan <nd...@dtechspace.com> wrote:

> One of the problem when using the JNDI API is that it's hard to manage LDAP
> connections.   It is common that LDAP servers close connections that have
> been idle for a while automatically.   When that happens, you will have to
> restart your app server to be able to re-establish the LDAP connection.
> There is no straightforward way in JNDI to automatically detect the
> connection lost and reestablish the connection automatically, since the
> LDAP
> connection is completely hidden inside the directory context in JDNI.
>
>
>
> Is there any simple way to perform status checking on LDAP connections and
> reconnect automatically to LDAP using Apache DS API?   Any
> suggestions/hints
> are highly appreciated.
>
>
>
> ND
>
>


-- 
Kiran Ayyagari
http://keydap.com

Re: JNID vs. Apache DS API - Reconnect to LDAP

Posted by Kiran Ayyagari <ka...@apache.org>.
except in situations like, the network cable is unplugged or the server
crashes
 isConnected() gives the accurate status (even if server terminates the
client connection client is notified through a callback)

On Tue, Jan 29, 2013 at 7:47 PM, Jim Willeke <ji...@willeke.com> wrote:

> Within JNDI, you can search for some know entry and determine if it returns
> a value (or if an exception is thrown).
> If you get the "correct" response, you know you are good.
>
> I did not check, but undoubtedly, the isConnected() call is doing something
> similar as the LDAP protocol has no method to determine "isConnected".
>
> --
> -jim
> Jim Willeke
>
>
> On Tue, Jan 29, 2013 at 9:06 AM, Nick Duan <nd...@dtechspace.com> wrote:
>
> > One of the problem when using the JNDI API is that it's hard to manage
> LDAP
> > connections.   It is common that LDAP servers close connections that have
> > been idle for a while automatically.   When that happens, you will have
> to
> > restart your app server to be able to re-establish the LDAP connection.
> > There is no straightforward way in JNDI to automatically detect the
> > connection lost and reestablish the connection automatically, since the
> > LDAP
> > connection is completely hidden inside the directory context in JDNI.
> >
> >
> >
> > Is there any simple way to perform status checking on LDAP connections
> and
> > reconnect automatically to LDAP using Apache DS API?   Any
> > suggestions/hints
> > are highly appreciated.
> >
> >
> >
> > ND
> >
> >
>



-- 
Kiran Ayyagari
http://keydap.com

Re: JNID vs. Apache DS API - Reconnect to LDAP

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 1/29/13 3:17 PM, Jim Willeke a écrit :
> Within JNDI, you can search for some know entry and determine if it returns
> a value (or if an exception is thrown).
> If you get the "correct" response, you know you are good.
>
> I did not check, but undoubtedly, the isConnected() call is doing something
> similar as the LDAP protocol has no method to determine "isConnected".
The best would be to request periodically for the root entry, with 1.1
as a parameter (it won't return anything).

But by configuring the TCP Keepalive parameter, the connection should
not be closed.

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: JNID vs. Apache DS API - Reconnect to LDAP

Posted by Jim Willeke <ji...@willeke.com>.
Within JNDI, you can search for some know entry and determine if it returns
a value (or if an exception is thrown).
If you get the "correct" response, you know you are good.

I did not check, but undoubtedly, the isConnected() call is doing something
similar as the LDAP protocol has no method to determine "isConnected".

--
-jim
Jim Willeke


On Tue, Jan 29, 2013 at 9:06 AM, Nick Duan <nd...@dtechspace.com> wrote:

> One of the problem when using the JNDI API is that it's hard to manage LDAP
> connections.   It is common that LDAP servers close connections that have
> been idle for a while automatically.   When that happens, you will have to
> restart your app server to be able to re-establish the LDAP connection.
> There is no straightforward way in JNDI to automatically detect the
> connection lost and reestablish the connection automatically, since the
> LDAP
> connection is completely hidden inside the directory context in JDNI.
>
>
>
> Is there any simple way to perform status checking on LDAP connections and
> reconnect automatically to LDAP using Apache DS API?   Any
> suggestions/hints
> are highly appreciated.
>
>
>
> ND
>
>