X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 032CA3A43C6 for ; Wed, 24 Nov 2004 22:50:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13327-03 for ; Wed, 24 Nov 2004 22:50:02 +0000 (GMT) Received: from mail.opentransfer.com (mail.opentransfer.com [69.49.238.2]) by svr1.postgresql.org (Postfix) with SMTP id 7FEB53A43BA for ; Wed, 24 Nov 2004 22:50:03 +0000 (GMT) Received: (qmail 16750 invoked from network); 24 Nov 2004 22:50:03 -0000 Received: from unknown (HELO RogerPortable) (216.103.145.114) by mail.opentransfer.com with SMTP; 24 Nov 2004 22:50:03 -0000 Message-ID: <002801c4d277$ee33a640$0c02010a@RogerPortable> From: "Roger Niederland" To: "Oliver Jowett" Cc: References: <001501c4d266$055d3c30$0c02010a@RogerPortable> <41A50C30.9000108@opencloud.com> Subject: Re: query string on a prepared statement Date: Wed, 24 Nov 2004 14:50:00 -0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/203 X-Sequence-Number: 11625 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 > >