Re: Fastest way to check aliveness of connection

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Fastest way to check aliveness of connection
Дата
Msg-id 47C490A8.1090708@opencloud.com
обсуждение исходный текст
Ответ на Fastest way to check aliveness of connection  (Daniel Migowski <dmigowski@ikoffice.de>)
Ответы Re: Fastest way to check aliveness of connection  (Daniel Migowski <dmigowski@ikoffice.de>)
Список pgsql-jdbc
Daniel Migowski wrote:
> Hello,
>
> I want to implement a c3p0 ConnectionTester and now need a fast way to
> check for the alivelyness of a Connection. Currently I issue a "select
> 1" to the database and if I don't get an exception I assume the
> connection is still alive.
>
> Is there a faster way? How can I check if the underlying socket is still
> alive without doing a JDBC request? This has to work only with
> PostgreSQL JDBC, so I can cast to any postgres interface available.

Running an empty query ("") is probably the simplest way.

In theory you could do something slightly faster at the protocol level
(just send Sync and wait for ReadyForQuery) but there's no interface
currently exposed to do that and I doubt that it will be much faster
than an empty query anyway.

-O

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

Предыдущее
От: Andrea Aime
Дата:
Сообщение: Bug while retrieving money data type from db
Следующее
От: dmp
Дата:
Сообщение: Array Char/VarChar Size