JDBC BatchUpdateException.getUpdateCounts() Incorrect When PK Violation Against Partitioned Table
Last updated on MARCH 08, 2017
Applies to:JDBC - Version 220.127.116.11.0 and later
Information in this document applies to any platform.
When a set of batched prepared statement inserts to a partitioned table fails due to a primary key constraint violation, the JDBC BatchUpdateException.getUpdateCounts() method returns an array of -2 (java.sql.Statement.SUCCESS_NO_INFO) status counts. Since none of the batched inserts were successfully added to the table, getUpdateCounts should return -3 (Statement.EXECUTE_FAILED) instead, as described as expected on page 23-13 of the Oracle Database JDBC Developer's Guide and Reference.
Oracle® Database JDBC Developer's Guide
11g Release 2 (11.2)
23 Performance Extensions
This problem occurs with Oracle 18.104.22.168.0 JDBC driver using standard JDBC prepared statement update batching using a partitioned table.
It is observed with both 10.2.0.3.0 and 22.214.171.124.0 database server versions.
The 10.2.0.4.0 JDBC driver works correctly (returns -3 update counts), as does the 126.96.36.199.0 JDBC driver when using a non-partitioned table.
The issue does not occur when using JDBC OCI. The problem occurs only with JDBC Thin 11g and when inserting to a partitioned table.
Upgrade of JDBC driver from 10.2.0.4 to 188.8.131.52.
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms