pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Bob Fischer <citibob@comcast.net>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Problem with JDBC version 8.0/1 vs. 7.4
Date: Sun, 14 Jan 2007 01:37:37 -0500 (EST)
Message-ID: <Pine.BSO.4.64.0701140127210.26786@leary2.csoft.net> (raw)
In-Reply-To: <1168755462.7577.80.camel@wolfgang.home>
References: <1168755462.7577.80.camel@wolfgang.home>



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




view thread (2+ messages)

Message-ID: <Pine.BSO.4.64.0701140127210.26786@leary2.csoft.net>
Permalink:  ../Pine.BSO.4.64.0701140127210.26786@leary2.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.64.0701140127210.26786@leary2.csoft.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: books@ejurka.com, citibob@comcast.net
  Subject: Re: Problem with JDBC version 8.0/1 vs. 7.4
  In-Reply-To: <Pine.BSO.4.64.0701140127210.26786@leary2.csoft.net>
  References: <1168755462.7577.80.camel@wolfgang.home> <Pine.BSO.4.64.0701140127210.26786@leary2.csoft.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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