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 0608C3A3F06 for ; Tue, 2 Nov 2004 16:35:09 +0000 (GMT) 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 11316-03 for ; Tue, 2 Nov 2004 16:35:06 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id A3C353A3EFA for ; Tue, 2 Nov 2004 16:35:04 +0000 (GMT) Received: (qmail 12516 invoked from network); 2 Nov 2004 16:36:19 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 2 Nov 2004 16:36:19 -0000 Message-ID: <4187B766.4050602@fastcrypt.com> Date: Tue, 02 Nov 2004 11:35:50 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 0.8 (X11/20041001) X-Accept-Language: en-us, en MIME-Version: 1.0 To: stange@rentec.com Cc: pgsql-jdbc@postgresql.org Subject: Re: executeBatch() issue with new driver? References: <4187B025.2090201@rentec.com> In-Reply-To: <4187B025.2090201@rentec.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/20 X-Sequence-Number: 11442 Without looking at the code, I noticed that the javadoc's refer to addBatch as adding a single command, see below. Adds the given SQL command to the current list of commmands for this |Statement| object. The commands in this list can be executed as a batch by calling the method |executeBatch|. Dave Alan Stange wrote: > Hello all, > > I'm using pg8 beta 3, with the pgdev.307.jdbc3.jar JDBC driver. > > > If I run the following example code: > > Connection conn = ...; > Statement st = conn.createStatement(); > String sql = "create temp table t (a int4); insert into t (a) values > (1);"; > st.addBatch(sql); > st.executeBatch(); > > I get the following error: > > Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 > at > org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2317) > > at > org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleCommandStatus(AbstractJdbc2Statement.java:2293) > > at > org.postgresql.core.v3.QueryExecutorImpl.interpretCommandStatus(QueryExecutorImpl.java:1230) > > at > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:968) > > at > org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) > > at > org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2371) > > at com.rentec.fi.db.DbStatement.executeBatch(DbStatement.java:88) > > > Am I missing something here? > > Thanks! > > -- Alan > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561