Batch Update updatecounts when error happens - Mailing list pgsql-jdbc

From Padraic Renaghan
Subject Batch Update updatecounts when error happens
Date
Msg-id 1030560811.3d6d1c2b7f51e@mail.montanab.com
Whole thread Raw
Responses Re: Batch Update updatecounts when error happens  (Padraic Renaghan <list@renaghan.com>)
List pgsql-jdbc
I'm having trouble with the error handling of the batch update feature of the
JDBC 2.0 Postgresql driver. I do not see the standard behavior of returing a -3
for the statement that failed.

In my example I insert mutliple rows in a single batch into a table. All the
inserts have the same key value, which causes the second insert to fail with a
duplicate key error.

I get thrown back the BatchUpdateException which has the updateCounts array
which I access via getUpdateCounts(). That array contains a single entry,
updateCounts[0]=1. I am not seeing the -3 entry to indicate the stmt that
failed. According to my assumptions about how JDBC 2.0 batch updates are
supposed to work (and according to the JDBC--Postgresql compatability web page)
I was hoping to see the updateCounts array contain:
updateCounts[0]=1
updateCounts[1]=-3

I'm currently using Postgresql 7.2 and the JDBC driver installed with the
Postgresql distributed rpm. Specifically I'm using jdbc7.2dev-1.2.jar

Any help would be appreciated.

Thanks
Padraic

pgsql-jdbc by date:

Previous
From: "Michael Paesold"
Date:
Subject: Re: sharing Connection object and SQLExceptions
Next
From: Padraic Renaghan
Date:
Subject: Re: Batch Update updatecounts when error happens