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 A21963A4285 for ; Wed, 24 Nov 2004 22:28:49 +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 06387-03 for ; Wed, 24 Nov 2004 22:28:44 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 1C8D43A406F for ; Wed, 24 Nov 2004 22:28:44 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.21]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1CX5ct-00048G-00; Thu, 25 Nov 2004 11:28:40 +1300 Message-ID: <41A50C30.9000108@opencloud.com> Date: Wed, 24 Nov 2004 22:33:20 +0000 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Roger Niederland Cc: pgsql-jdbc@postgresql.org Subject: Re: query string on a prepared statement References: <001501c4d266$055d3c30$0c02010a@RogerPortable> In-Reply-To: <001501c4d266$055d3c30$0c02010a@RogerPortable> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/199 X-Sequence-Number: 11621 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