Connection state after network failure?

Поиск
Список
Период
Сортировка
От Kevin Birkett
Тема Connection state after network failure?
Дата
Msg-id 346FF8985107AA41AC92CEC80E21E6B5BBC7@phxx05.exchange.phxx
обсуждение исходный текст
Ответы Re: Connection state after network failure?  (Scott Marlowe <smarlowe@g2switchworks.com>)
Re: Connection state after network failure?  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
Hello,
 
I'm having a problem with our software which uses Postgres 7.2.3 and the JDBC driver associated with it.  In our code we only create one connection to the database, and then use that connection as needed for our DB interaction.  The problem comes in when I simulate a network failure (yank the cat5) after the app has started up and connected to the remote database.  I've tried an idea I found by searching the archives of this mailing list, but I haven't been able to get it to work.
 
My current technique is:
 
try {
      con.createStatement().execute("Select 1");
} catch (Exception e) {
......
......
}
 
To me, if the connection loses its network connectivity, an exception should be thrown here, and then I can handle it.  However, what actually happens is the system locks up on the call to execute and it never throws and exception or a returns value (since the network is unavailable).  Am I missing something easy here?  All I want to do is to check whether or not the connection is valid and available.
 
Thanks for any help you can give.
 
Kevin

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Vit Timchishin
Дата:
Сообщение: Re: use connection pooling
Следующее
От: "Chris Gamache"
Дата:
Сообщение: stringtype=unspecified problem