an efficient way of checking if the connection to a db is actually open

From: Assad Jarrahian <jarraa(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: an efficient way of checking if the connection to a db is actually open
Date: 2005-12-15 20:47:03
Message-ID: 4bd3e1480512151247u50479082vd08b9a1563d54604@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi All,
Trying to check if a connection is actually open every time I perform an
operation (if not, I want to reopen it and perform that operation).
isClosed()
*<http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Connection.html#isClosed%28%29>
* is no good, as in, it only guarantees true if close() was actually called
on it.

The documentation says, the only real way is to actually call an sql
statement on it. That seems inefficient. Is there any other way that is
recommended?
Much thanks in advance.

-assad

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Paul Thomas 2005-12-15 21:38:11 Re: an efficient way of checking if the connection to a db is actually open
Previous Message Dave Cramer 2005-12-14 17:41:58 Re: CallableStatements: index starts at 2