From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Bob Fischer <citibob(at)comcast(dot)net> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Problem with JDBC version 8.0/1 vs. 7.4 |
Date: | 2007-01-14 06:37:37 |
Message-ID: | Pine.BSO.4.64.0701140127210.26786@leary2.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Heiko W.Rupp | 2007-01-15 11:13:07 | executeBatch() and operation after error |
Previous Message | Bob Fischer | 2007-01-14 06:17:42 | Problem with JDBC version 8.0/1 vs. 7.4 |