Skip site navigation (1) Skip section navigation (2)

incomplete batch-inserts

From: "Marcel Steinbach" <steinbach(at)gmx(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: incomplete batch-inserts
Date: 2007-07-11 12:58:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

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);

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

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


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

Best Regards

Marcel Steinbach

pgsql-jdbc by date

Next:From: Marcel SteinbachDate: 2007-07-11 13:17:19
Subject: incomplete batch-updates
Previous:From: Diego ZangaDate: 2007-07-11 09:07:49
Subject: postgres jdbc into eclipse plugin (OID problems)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group