X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2DDB09DCC38 for ; Thu, 15 Dec 2005 18:37:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91339-02 for ; Thu, 15 Dec 2005 18:37:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by postgresql.org (Postfix) with SMTP id 9A76A9DCC77 for ; Thu, 15 Dec 2005 18:37:21 -0400 (AST) Received: (qmail 11032 invoked by uid 1112); 15 Dec 2005 22:41:24 -0000 Date: Thu, 15 Dec 2005 17:41:23 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Tom Lane cc: Assad Jarrahian , pgsql-jdbc@postgresql.org Subject: Re: an efficient way of checking if the connection to a db In-Reply-To: <17552.1134685460@sss.pgh.pa.us> Message-ID: References: <4bd3e1480512151247u50479082vd08b9a1563d54604@mail.gmail.com> <17552.1134685460@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/67 X-Sequence-Number: 14398 On Thu, 15 Dec 2005, Tom Lane wrote: > It probably is. However, sending an empty query string to the backend > to execute ought to be competitive with a bare Sync. libpq supports > that; does JDBC? You can say Statement.execute(""), but that still does the full extended query protocol setup: 14:25:48.375 (1) FE=> Parse(stmt=null,query="",oids={}) 14:25:48.377 (1) FE=> Bind(stmt=null,portal=null) 14:25:48.378 (1) FE=> Describe(portal=null) 14:25:48.378 (1) FE=> Execute(portal=null,limit=0) 14:25:48.378 (1) FE=> Sync 14:25:48.379 (1) <=BE ParseComplete [null] 14:25:48.380 (1) <=BE BindComplete [null] 14:25:48.380 (1) <=BE NoData 14:25:48.380 (1) <=BE EmptyQuery 14:25:48.381 (1) <=BE ReadyForQuery(I) Testing this with the V2 protocol reveals an issue, but it looks like the server's fault. 14:33:42.550 (1) FE=> Query("") 14:33:42.550 (1) <=BE EmptyQuery At this point the driver is waiting for ReadyForQuery, but the server is waiting for another query. The documentation states, "If a completely empty (no contents other than whitespace) query string is received, the response is EmptyQueryResponse followed by ReadyForQuery." Kris Jurka