From: Alexander Stanier <alexander.stanier@egsgroup.com>
To: Maciek Sakrejda <m.sakrejda@gmail.com>
Cc: Dave Cramer <pg@fastcrypt.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Change in Log Format and Prepared Statements
Date: Mon, 17 Sep 2012 07:58:21 +0100
Message-ID: <5056CA0D.7090109@egsgroup.com> (raw)
In-Reply-To: <CAOtHd0Df2_L=k+OxpWgNXso2w298V=D1GY7RDfwczTta=WjaJg@mail.gmail.com>
References: <5051D5DA.8050404@egsgroup.com>
<CADK3HHLdcyq54NRCa7qYr0UiBZVxh9np=y1WJrCbq9zKfg1EfA@mail.gmail.com>
<CAOtHd0Df2_L=k+OxpWgNXso2w298V=D1GY7RDfwczTta=WjaJg@mail.gmail.com>
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font size="-1"><font face="Helvetica, Arial, sans-serif">Thanks
Maciek for your advice which I will pass back to our Java
developers. We are using a combination of Torque and Hibernate
to access the database via jdbc. I think Hibernate passes
parameters as you suggest but Torque doesn't. We are slowly
moving away from Torque to Hibernate.<br>
<br>
Do you know if there is any documentation on the "unnamed
variant" of prepared statements? I've read the pages on PREPARE
and EXECUTE but they don't go into much depth about what happens
in the background.<br>
<br>
Alex Stanier.<br>
<br>
</font></font>
<div class="moz-cite-prefix">On 13/09/2012 21:12, Maciek Sakrejda
wrote:<br>
</div>
<blockquote
cite="mid:CAOtHd0Df2_L=k+OxpWgNXso2w298V=D1GY7RDfwczTta=WjaJg@mail.gmail.com"
type="cite">
<pre wrap="">To clarify, when prepareThreshold is set to zero, the driver still
uses prepared statements, but it uses only the unnamed variant, which
should effectively have no overhead compared to inlining parameters.
The separate log messages are due to this change.
Safely passing in parameters is an important reason to use prepared
statements (perhaps more so than performance), so as to protect
against SQL injection. For what it's worth, based on the logs, it
looks like you're not doing that; you should seriously consider making
that change, especially if data like user names is coming externally.
This email has been scanned for viruses by Blackspider's Mail Control System.
For more information please visit <a class="moz-txt-link-freetext" href="http://www.blackspider.com">http://www.blackspider.com</a;
</pre>
</blockquote>
<br>
<br><br>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for malware by SurfControl plc. </FONT><A href="http://www.surfcontrol.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.surfcontrol.com</FONT></A></P>
</body>
</html>
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: alexander.stanier@egsgroup.com, m.sakrejda@gmail.com, pg@fastcrypt.com
Subject: Re: Change in Log Format and Prepared Statements
In-Reply-To: <5056CA0D.7090109@egsgroup.com>
References: <5051D5DA.8050404@egsgroup.com> <CADK3HHLdcyq54NRCa7qYr0UiBZVxh9np=y1WJrCbq9zKfg1EfA@mail.gmail.com> <CAOtHd0Df2_L=k+OxpWgNXso2w298V=D1GY7RDfwczTta=WjaJg@mail.gmail.com> <5056CA0D.7090109@egsgroup.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