Any way to *not* use server-side prepared statements in Postgresql?

From: Yang Zhang <yanghatespam(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Any way to *not* use server-side prepared statements in Postgresql?
Date: 2011-07-19 02:07:05
Message-ID: CAKxBDU9zBWCSe0ds0Vx75dpc_Rogxv2CfBCiQSrFWtrs3BTaAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

In (say) Python, I can issue:

psycopg2.connect(...).cursor().execute("select * from account
where id='00100000006ONCrAAO'")

which on the server results in the following log entries:

2011-07-18 18:56:08 PDT LOG: duration: 6.112 ms statement:
select * from account where id='00100000006ONCrAAO'

However, in Java, issuing:

conn.createStatement().executeQuery("select * from account where
id = '00100000006ONCrAAO'");

results in:

2011-07-18 18:44:59 PDT LOG: duration: 4.353 ms parse <unnamed>:
select * from account where id = '00100000006ONCrAAO'
2011-07-18 18:44:59 PDT LOG: duration: 0.230 ms bind <unnamed>:
select * from account where id = '00100000006ONCrAAO'
2011-07-18 18:44:59 PDT LOG: duration: 0.246 ms execute
<unnamed>: select * from account where id = '00100000006ONCrAAO'

Some searching shows that the PG JDBC driver *always* uses prepared
statements: http://postgresql.1045698.n5.nabble.com/JDBC-prepared-statements-amp-server-side-prepared-statements-td1919506.html

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.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Radosław Smogura 2011-07-19 02:45:20 Re: Any way to *not* use server-side prepared statements in Postgresql?
Previous Message Kevin Grittner 2011-07-18 14:33:20 9.1 non-devel jar