From: Dave Cramer <pg@fastcrypt.com>
To: stange@rentec.com
Cc: pgsql-jdbc@postgresql.org
Subject: Re: executeBatch() issue with new driver?
Date: Tue, 02 Nov 2004 11:35:50 -0500
Message-ID: <4187B766.4050602@fastcrypt.com> (raw)
In-Reply-To: <4187B025.2090201@rentec.com>
References: <4187B025.2090201@rentec.com>
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
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: pg@fastcrypt.com, stange@rentec.com
Subject: Re: executeBatch() issue with new driver?
In-Reply-To: <4187B766.4050602@fastcrypt.com>
References: <4187B025.2090201@rentec.com> <4187B766.4050602@fastcrypt.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