incomplete batch-inserts - Mailing list pgsql-jdbc

From Marcel Steinbach
Subject incomplete batch-inserts
Date
Msg-id 20070711125811.313870@gmx.net
Whole thread Raw
List pgsql-jdbc
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

pgsql-jdbc by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: questions regarding transactions
Next
From: Dave Cramer
Date:
Subject: Re: questions regarding transactions