executing batch select queries

From: ng(at)maritimesource(dot)ca (Justin Kennedy)
To: pgsql-jdbc(at)postgresql(dot)org
Subject: executing batch select queries
Date: 2004-08-08 04:02:14
Message-ID: 802eaf32.0408072002.400e4538@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Alexandre Aufrere 2004-08-08 08:04:02 Re: Problems with charsets, investigated...
Previous Message Jan de Visser 2004-08-08 03:12:36 Re: Problems with charsets, investigated...