pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ng@maritimesource.ca
To: pgsql-jdbc@postgresql.org
Subject: executing batch select queries
Date: 7 Aug 2004 21:02:14 -0700
Message-ID: <802eaf32.0408072002.400e4538@posting.google.com> (raw)

Hi,

Short version:
How can I do batch select queries with jdbc-postgresql?

Long version:
I'm migrating a transaction management system from Oracle to
PostgreSQL.

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.

So then I figured it wasn't supported and looked up the 'executeBatch'
function, but now that leads me to this problem:

This works:
stmt.executeQuery("select * from pay_methods");

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.

Please advise me on how to accomplish batch select queries.

Thanks for the help,
-Justin



view thread (3+ messages)  latest in thread

Message-ID: <802eaf32.0408072002.400e4538@posting.google.com>
Permalink:  ../802eaf32.0408072002.400e4538@posting.google.com/
Also on:    postgresql.org/message-id/802eaf32.0408072002.400e4538@posting.google.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: ng@maritimesource.ca
  Subject: Re: executing batch select queries
  In-Reply-To: <802eaf32.0408072002.400e4538@posting.google.com>
  References: <802eaf32.0408072002.400e4538@posting.google.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