Re: query string on a prepared statement

From: "Roger Niederland" <roger(at)niederland(dot)com>
To: "Oliver Jowett" <oliver(at)opencloud(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: query string on a prepared statement
Date: 2004-11-24 22:50:00
Message-ID: 002801c4d277$ee33a640$0c02010a@RogerPortable
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


Similar code work previously on DB2, Mysql and earlier versions of the
released postgresql jdbc drivers. So I assumed that this was a driver
problem.
Thanks, for the quick response!

> 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
>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vadim Nasardinov 2004-11-25 02:34:05 failures in dbMetaClient1 (was: Re: CTS 1.3.1 results)
Previous Message Thomas Hallgren 2004-11-24 22:48:52 Re: UNICODE and 8.0.0beta5