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