Detecting 'socket errors' - closing the Connection object

Поиск
Список
Период
Сортировка
От David Wall
Тема Detecting 'socket errors' - closing the Connection object
Дата
Msg-id 00c301c34fae$edf5ab30$3201a8c0@rasta
обсуждение исходный текст
Ответ на Fix for receiving empty query errors.  (Kim Ho <kho@redhat.com>)
Ответы Re: Detecting 'socket errors' - closing the Connection object  (Dmitry Tkach <dmitry@openratings.com>)
Re: Detecting 'socket errors' - closing the Connection object  (Oliver Jowett <oliver@opencloud.com>)
Список pgsql-jdbc
I have a connection pool that opens several connections and passes them out
to individual threads as needed.  Normally this works just fine.  However,
if the postgresql database is restarted, or if the database is on another
network segment, hiccups on the network will cause socket errors on the
underlying JDBC connection.

When a connection is returned to the pool, I'm calling the 'isClosed()'
method to see if the underlying connection has been closed, but apparently
when there is a socket error, the JDBC connection is not automatically being
closed, despite the fact that such an error will always be unrecoverable.

I've also seen the same problem occur on the Oracle JDBC drivers (oracle sql
exception errors 17002 and 17008).

Is there a reason why the JDBC implementations don't close the Connection
object when they get an I/O error on the socket?  Or am I doing something
else wrong in trying to detect that the connection has failed and must be
closed and reopened before being used again?

Thanks,
David


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

Предыдущее
От: Kim Ho
Дата:
Сообщение: Fix for receiving empty query errors.
Следующее
От: Fernando Nasser
Дата:
Сообщение: Re: IN clauses via setObject(Collection) [Was: Re: Prepared