Talk About Network

Google





Data Bases > Pgsql Interfaces Jdbc > Re: Fastest way...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 1893 of 2101
Post > Topic >>

Re: Fastest way to check aliveness of connection

by oliver@[EMAIL PROTECTED] (Oliver Jowett) Feb 27, 2008 at 11:20 AM

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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@[EMAIL PROTECTED]
 so that your
       message can get through to the mailing list cleanly
 




 3 Posts in Topic:
Fastest way to check aliveness of connection
dmigowski@[EMAIL PROTECTE  2008-02-26 14:36:56 
Re: Fastest way to check aliveness of connection
oliver@[EMAIL PROTECTED]   2008-02-27 11:20:24 
Re: Fastest way to check aliveness of connection
dmigowski@[EMAIL PROTECTE  2008-02-27 08:57:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 20:12:37 PST 2009.