pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marcel Steinbach <steinbach@gmx.com>
To: pgsql-jdbc@postgresql.org
Subject: incomplete batch-updates
Date: Wed, 11 Jul 2007 15:17:19 +0200
Message-ID: <20070711131719.313880@gmx.net> (raw)

Hello,

i'm having trouble with batches. When I run into an BatchUpdateException,
the table is filled up to a multiple of 256 records (guess, the batch seems to be executed in 256-steps), and, for example, if the Exception was thrown at the 300. statements, the tablesize is 256, and 44 are missing - but: The getUpdateCount() says, that all statements until the Exception (299) affacted "1" row.


My code looks something like this:
---------------------------------------------------------
PreparedStatement stmt = con.prepareStatement(sql);
con.setAutoCommit(true);

for (int i = 0; i < objectBuffer.length; i++) {
    for (int j =0; j < objectBuffer[i].length; j++) {
        stmt.setObject(j+1, objectBuffer[i][j]);
    }
    stmt.addBatch();
}

int updateCount[] = { };
try {
    updateCount = stmt.executeBatch();
} catch (...) { ...

---------------------------------------------------------

Some ideas whats wrong? I'm using postgresql-8.1-405.jdbc3.

Best Regards

Marcel Steinbach



view thread (2+ messages)  latest in thread

Message-ID: <20070711131719.313880@gmx.net>
Permalink:  ../20070711131719.313880@gmx.net/
Also on:    postgresql.org/message-id/20070711131719.313880@gmx.net

 · 

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: steinbach@gmx.com
  Subject: Re: incomplete batch-updates
  In-Reply-To: <20070711131719.313880@gmx.net>
  References: <20070711131719.313880@gmx.net>

* 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