Re: How to detect when a connection times out ?
From: Joe Weinstein (joeNOSPAM_at_bea.com)
Date: 08/25/04
- Next message: davout: "Re: Newbie MySQL question: how to retrieve latest entry from a history of entries?"
- Previous message: Flip: "Re: Newbie MySQL question: how to retrieve latest entry from a history of entries?"
- In reply to: Leny: "How to detect when a connection times out ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 25 Aug 2004 09:38:16 -0700 To: Leny <leny00004@hotmail.com>
Leny wrote:
> Hi,
>
> I'm looking for a standard way to know when a connection has been
> timed out.
Hi. There is no standard way. Choose a query or call that you are sure has to go to the
DBMS, and is as fast and uncontentious as possible.
> Right now, I found the following solutions:
>
> - Make a query and check out the result. If it's an exception,
> reopen the connection.
That's the only way. Also note that the connection could go bad immediately after your
test query succeeded... The fundamental fact is that a client can never know if it's
next attempt to talk to the server will succeed.
> - Just check every exception for every query.
>
> Well, as you can see they are far from ideal solutions. I just
> can't check the isClosed() because it only returns true when the
> *client* closes the connection.
>
Correct. That is the JDBC spec.
> Do you know any way to know if the connection is active ? Any
> comments would be really welcome.
>
> Thanks in advance,
>
> - Leny
- Next message: davout: "Re: Newbie MySQL question: how to retrieve latest entry from a history of entries?"
- Previous message: Flip: "Re: Newbie MySQL question: how to retrieve latest entry from a history of entries?"
- In reply to: Leny: "How to detect when a connection times out ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|