From: Oliver Jowett <oliver@opencloud.com>
To: Roger Niederland <roger@niederland.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: query string on a prepared statement
Date: Wed, 24 Nov 2004 22:33:20 +0000
Message-ID: <41A50C30.9000108@opencloud.com> (raw)
In-Reply-To: <001501c4d266$055d3c30$0c02010a@RogerPortable>
References: <001501c4d266$055d3c30$0c02010a@RogerPortable>
Roger Niederland wrote:
> Using pg80b1.308.jdbc3.jar got the following: (worked with
> pg74.215.jdbc3.jar)
>
> Code:
> results = stmt.executeQuery("SELECT currval('LoginLog_LoginLogID_seq')");
>
> Stack Trace:
> org.postgresql.util.PSQLException: Can't use query methods that take a
> query string on a PreparedStatement.
As it says, you can't use executeQuery(String) on a PreparedStatement.
Use it on a Statement created via Connection.createStatement() instead.
The JDBC spec requires that PreparedStatement throw an exception in this
case. Older drivers did not follow the spec.
-O
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, roger@niederland.com
Subject: Re: query string on a prepared statement
In-Reply-To: <41A50C30.9000108@opencloud.com>
References: <001501c4d266$055d3c30$0c02010a@RogerPortable> <41A50C30.9000108@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