pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedquery string on a prepared statement
3+ messages / 2 participants
[nested] [flat]
* query string on a prepared statement
@ 2004-11-24 20:41 Roger Niederland <roger@niederland.com>
2004-11-24 22:33 ` Re: query string on a prepared statement Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 3+ messages in thread
From: Roger Niederland @ 2004-11-24 20:41 UTC (permalink / raw)
To: pgsql-jdbc
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.
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:203)
at
org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
postgresql version: 8.0beta5
Thanks,
Roger
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: query string on a prepared statement
2004-11-24 20:41 query string on a prepared statement Roger Niederland <roger@niederland.com>
@ 2004-11-24 22:33 ` Oliver Jowett <oliver@opencloud.com>
2004-11-24 22:50 ` Re: query string on a prepared statement Roger Niederland <roger@niederland.com>
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Jowett @ 2004-11-24 22:33 UTC (permalink / raw)
To: Roger Niederland <roger@niederland.com>; +Cc: pgsql-jdbc
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: query string on a prepared statement
2004-11-24 20:41 query string on a prepared statement Roger Niederland <roger@niederland.com>
2004-11-24 22:33 ` Re: query string on a prepared statement Oliver Jowett <oliver@opencloud.com>
@ 2004-11-24 22:50 ` Roger Niederland <roger@niederland.com>
0 siblings, 0 replies; 3+ messages in thread
From: Roger Niederland @ 2004-11-24 22:50 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; +Cc: 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
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-11-24 22:50 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-11-24 20:41 query string on a prepared statement Roger Niederland <roger@niederland.com>
2004-11-24 22:33 ` Oliver Jowett <oliver@opencloud.com>
2004-11-24 22:50 ` Roger Niederland <roger@niederland.com>
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