My Oracle Support Banner

JDBC BatchUpdateException.getUpdateCounts() Incorrect When PK Violation Against Partitioned Table (Doc ID 1462943.1)

Last updated on AUGUST 30, 2023

Applies to:

JDBC - Version 11.2.0.1.0 and later
Information in this document applies to any platform.

Symptoms


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
Update Batching

This problem occurs with Oracle 11.2.0.1.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 11.2.0.1.0 database server versions.
The 10.2.0.4.0 JDBC driver works correctly (returns -3 update counts), as does the 11.2.0.1.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.

Changes

 Upgrade of JDBC driver from 10.2.0.4 to 11.2.0.1.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.