Question

I'm using javax naming to connect to an LDAP database. Is there a good way to check if a connection is still valid? I'm looking for something really efficient here because it may need to be done often.

After some web searching all I have found is a suggestion to do a quick search, is there any more lightweight way?

/mac

Was it helpful?

Solution

Is there a reason you can't just assume it is still valid? That seems the most efficient. Encapsulate the LDAP communication in a class. You can handle any exceptions due to a dropped connection by reconnecting and then re-performing the requested operation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top