Re: PG 8.0.3 - PreparedStatement Can't Use Query Methods - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: PG 8.0.3 - PreparedStatement Can't Use Query Methods
Date
Msg-id Pine.BSO.4.56.0508101148520.20899@leary.csoft.net
Whole thread Raw
In response to PG 8.0.3 - PreparedStatement Can't Use Query Methods exception  (David Wall <d.wall@computer.org>)
Responses Re: PG 8.0.3 - PreparedStatement Can't Use Query Methods exception  (David Wall <d.wall@computer.org>)
List pgsql-jdbc

On Wed, 10 Aug 2005, David Wall wrote:

> We are converting from a 7.3 PG database to 8.0.3 and mostly all is
> working okay.  We are using postgresql-8.1dev-400.jdbc3.jar for JDBC.
>
> Previously, we never received this sort of error.  The idea is that
> certain SQLExceptions are passed to a routine in our connection pool
> that attempts to see if the Connection object is still valid or not by
> doing a simple SELECT 1 command.  This command still works fine via psql.
>
> org.postgresql.util.PSQLException: Can''t use query methods that take a
> query string on a PreparedStatement.
>         at
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:218)
>         at
>
> What am I doing wrong here?  It seems so straightforward.  We create a
> preparedStatement with a simple SELECT and then execute the query and
> ignore the result set that may come back.
>

The JDBC 3 Spec 13.2.4 says, "If any of the PreparedStatement execute
methods is called with an SQL string as a parameter, an SQLException is
thrown."

Kris Jurka

pgsql-jdbc by date:

Previous
From: David Wall
Date:
Subject: PG 8.0.3 - PreparedStatement Can't Use Query Methods exception
Next
From: David Wall
Date:
Subject: Re: PG 8.0.3 - PreparedStatement Can't Use Query Methods exception