pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Justin Kennedy <ng@maritimesource.ca>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: executing batch select queries
Date: Mon, 09 Aug 2004 00:00:57 +1200
Message-ID: <411615F9.1040904@opencloud.com> (raw)
In-Reply-To: <802eaf32.0408072002.400e4538@posting.google.com>
References: <802eaf32.0408072002.400e4538@posting.google.com>

Justin Kennedy wrote:

> We use batch select queries quite a bit, and to accomplish this in
> Oracle we just separated the queries with "\n" and ran:
> stmt.executeQuery(sql).
> 
> Doing this in PostgreSQL (with a semicolon as a delimeter) generates
> this error:
> Cannot handle multiple result groups.

Try the latest development driver from jdbc.postgresql.org. That version 
should handle queries that return multiple resultsets correctly. This 
was added in build 303. It hasn't had huge amounts of testing, though, 
since it's an uncommonly used feature.

> But this doesn't:
> stmt.clearBatch();
> stmt.addBatch("select * from pay_methods");
> stmt.executeBatch();
> 
> The following error is output:
> Batch entry 0 .... Call getNextException() to see the cause. calling
> getNextException() produces this:
> A result was returned when none was expected.

Yeah, this isn't ever going to work, the JDBC spec requires the driver 
to complain if you give a SELECT-style query to addBatch() (and how 
would you get the results, anyway?)

-O



view thread (3+ messages)  latest in thread

Message-ID: <411615F9.1040904@opencloud.com>
Permalink:  ../411615F9.1040904@opencloud.com/
Also on:    postgresql.org/message-id/411615F9.1040904@opencloud.com

 · 

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: oliver@opencloud.com, ng@maritimesource.ca
  Subject: Re: executing batch select queries
  In-Reply-To: <411615F9.1040904@opencloud.com>
  References: <802eaf32.0408072002.400e4538@posting.google.com> <411615F9.1040904@opencloud.com>

* 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