Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 754169FB1E6 for ; Wed, 18 Oct 2006 17:28:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 75829-02 for ; Wed, 18 Oct 2006 20:27:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id E59369FA4EE for ; Wed, 18 Oct 2006 17:27:57 -0300 (ADT) Received: from 222-153-172-120.jetstream.xtra.co.nz ([222.153.172.120] helo=[10.1.1.3]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1GaI12-0006EK-BN; Thu, 19 Oct 2006 09:27:52 +1300 Message-ID: <45368E38.4090008@opencloud.com> Date: Wed, 18 Oct 2006 20:27:36 +0000 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tore Halset CC: pgsql-jdbc@postgresql.org Subject: Re: prepared statements and sql injection References: <27E3C862-C1A8-4063-8F34-819A4C4F786F@pvv.ntnu.no> In-Reply-To: <27E3C862-C1A8-4063-8F34-819A4C4F786F@pvv.ntnu.no> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200610/96 X-Sequence-Number: 15979 Tore Halset wrote: > Without specifying a PrepareThreshold, are my sql statements > "unprepared" in the jdbc driver before sent to the server? Or are they > sent to the server as prepared statements? Does the PrepareThreshold > control whether my statements are actually prepared or if the execution > plan are cached? When using the v3 protocol (7.4 servers and later) parameter values are always sent out-of-line from the query. The prepare threshold controls server-side statement reuse (i.e. caching of parse/plan results) only. Even in cases where parameters are interpolated into the query string (e.g. when talking to a pre-7.4 server) the driver makes sure that parameter values are correctly quoted, so as long as you are correctly using parameter placeholders at the JDBC level you shouldn't need to worry about injection vulnerabilities there. -O