Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 6DBAAB5DC02 for ; Tue, 19 Jul 2011 01:00:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 41397-07 for ; Tue, 19 Jul 2011 03:59:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id 5A06AB5DC00 for ; Tue, 19 Jul 2011 00:59:56 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id 6D14037; Mon, 18 Jul 2011 23:59:55 -0400 (EDT) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id R3dZxN8Dn8vW; Mon, 18 Jul 2011 23:59:51 -0400 (EDT) Received: from mail.postnewspapers.com.au (ppp171-128.static.internode.on.net [150.101.171.128]) by www.postnewspapers.com.au (Postfix) with ESMTP id 1C84827; Mon, 18 Jul 2011 23:59:51 -0400 (EDT) Received: from [10.0.0.53] (wallace.localnet [10.0.0.53]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 1362EAE454; Tue, 19 Jul 2011 11:59:50 +0800 (WST) Message-ID: <4E250136.4070807@postnewspapers.com.au> Date: Tue, 19 Jul 2011 11:59:50 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110307 Thunderbird/3.1.9 MIME-Version: 1.0 To: Yang Zhang CC: pgsql-jdbc@postgresql.org Subject: Re: Any way to *not* use server-side prepared statements in Postgresql? References: In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.035 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.135 X-Spam-Level: X-Archive-Number: 201107/26 X-Sequence-Number: 22030 On 19/07/11 10:07, Yang Zhang wrote: > Is there any way to circumvent server prepared statements? If it makes > a difference, I'm asking regarding PG 8.4 and 9.0. Thanks in advance. http://jdbc.postgresql.org/documentation/84/server-prepare.html Set the prepare threshold using a call to the PGStatement interface of the Statement you're interested in to control it on a statement by statement level. This requires access to the real, unwrapped Statement instance, which isn't available through some connection pooling systems. You can set the prepare threshold using the prepareThreshold connection argumnent to set it for all statements. Whether 0 or -1 disables prepared statements don't seem to be documented. Check the PgJDBC sources, or give it a try and see. -- Craig Ringer