Reputation: 3
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
Upvotes: 0
Views: 2402
Reputation: 14701
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.
Upvotes: 2