X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9A7C05E46C2 for ; Sun, 8 Aug 2004 09:01:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28734-08 for ; Sun, 8 Aug 2004 12:01:00 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 7A6F55E4699 for ; Sun, 8 Aug 2004 09:00:59 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1BtmMF-0004y7-00; Mon, 09 Aug 2004 00:00:59 +1200 Message-ID: <411615F9.1040904@opencloud.com> Date: Mon, 09 Aug 2004 00:00:57 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Justin Kennedy Cc: pgsql-jdbc@postgresql.org Subject: Re: executing batch select queries References: <802eaf32.0408072002.400e4538@posting.google.com> In-Reply-To: <802eaf32.0408072002.400e4538@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200408/63 X-Sequence-Number: 10785 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