Use the Connection.isClosed() method, according to the code comments, this
will test the connection for you.
-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Jacob Vennervald
Madsen
Sent: Tuesday, August 06, 2002 8:10 AM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] Can I check if a db connection is working?
Hi List
I have a database handler with a persistent connection to a Postgres
database.
The problem is that if the TCP/IP connection between the database and the
application is temporaryly down then I have to restart my application
afterwards to reestablish the connection. This happens for example when the
database is restarted with mode fast.
Is there any way to check if the database connection is working before using
it?
Best regards,
Jacob Vennervald Madsen
Systems Developer
GoPinocchio
Norrebrogade 45
DK-2200 Copenhagen
www.gopinocchio.com
+45 26750106
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html