pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Tore Halset <halset@pvv.ntnu.no>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: prepared statements and sql injection
Date: Wed, 18 Oct 2006 20:27:36 +0000
Message-ID: <45368E38.4090008@opencloud.com> (raw)
In-Reply-To: <27E3C862-C1A8-4063-8F34-819A4C4F786F@pvv.ntnu.no>
References: <27E3C862-C1A8-4063-8F34-819A4C4F786F@pvv.ntnu.no>

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



view thread (2+ messages)

Message-ID: <45368E38.4090008@opencloud.com>
Permalink:  ../45368E38.4090008@opencloud.com/
Also on:    postgresql.org/message-id/45368E38.4090008@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, halset@pvv.ntnu.no
  Subject: Re: prepared statements and sql injection
  In-Reply-To: <45368E38.4090008@opencloud.com>
  References: <27E3C862-C1A8-4063-8F34-819A4C4F786F@pvv.ntnu.no> <45368E38.4090008@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox