Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id DE3189FB350 for ; Sun, 14 Jan 2007 02:37:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 76670-04 for ; Sun, 14 Jan 2007 02:37:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with ESMTP id 8AD5A9FB347 for ; Sun, 14 Jan 2007 02:37:38 -0400 (AST) Received: by mail63.csoft.net (Postfix, from userid 1112) id C6CFCF435; Sun, 14 Jan 2007 01:37:37 -0500 (EST) Date: Sun, 14 Jan 2007 01:37:37 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary2.csoft.net To: Bob Fischer cc: pgsql-jdbc@postgresql.org Subject: Re: Problem with JDBC version 8.0/1 vs. 7.4 In-Reply-To: <1168755462.7577.80.camel@wolfgang.home> Message-ID: References: <1168755462.7577.80.camel@wolfgang.home> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/93 X-Sequence-Number: 16458 On Sun, 14 Jan 2007, Bob Fischer wrote: > I'm trying to run the SQL statement found below. Meaning, if I have a > String sql set to the big hunk of text below the '----', I then call > ResultSet rs = statement.executeQuery(sql); > > When I use the JDBC Driver v7.4, everything works just fine (and it > returns some rows). But when I use JDBC Driver v8.0 or v8.1, I get the > following Exception: > > org.postgresql.util.PSQLException: No results were returned by the > query. > Newer JDBC drivers return all of the results from a multi statement query execution instead of just the last one. You should call it like so: stmt.execute("SELECT 1; UPDATE t SET a=1; SELECT 2;"); ResultSet rs = stmt.getResultSet(); stmt.getMoreResults(); int count = stmt.getUpdateCount(); rs = stmt.getResultSet(); Kris Jurka