Internal kprb JDBC Driver Binding String Errors in UTF8 / AL32UTF8 Database (Doc ID 827963.1)

Last updated on SEPTEMBER 21, 2017

Applies to:

Oracle Server - Enterprise Edition - Version: 11.1.0.7
This problem can occur on any platform.

Symptoms

When updating an updateable (and scrollable) resultset String field in an UTF8 (AL32UTF8) character set with updateRow(), following runtime error occurs:

ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.sql.SQLException: Value conflicts occurs

To test the behaviour you can use following code:
-- CREATE TABLE.
create table TEST_11G (
  PK1  NVARCHAR2(30),
  PK2  NUMBER(10),
  VAL1 NVARCHAR2(30),
  VAL2 NUMBER(10));

-- Insert row into table.
insert into test_11g (pk1, pk2, val1, val2) values ('001', 1, 'TEST', 1);
commit;

-- Create java source code.
CREATE OR REPLACE and compile JAVA SOURCE NAMED cms."OracleJdbcTestClass" as
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import oracle.jdbc.OraclePreparedStatement;
import oracle.jdbc.OracleResultSet;

public class OracleJdbcTestClass  {

  public static void testJavaCallUpdate() throws Exception,SQLException {
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    conn.setAutoCommit(false);
    OraclePreparedStatement tmpDS;
    tmpDS = (OraclePreparedStatement) conn.prepareStatement(
      "select t.val1, t.rowid from test_11g t where t.pk1 = ? and t.pk2 = ?",
      ResultSet.TYPE_FORWARD_ONLY,
      ResultSet.CONCUR_UPDATABLE);
    tmpDS.setString(1, "001");
    tmpDS.setInt(2, 1);
    OracleResultSet tmpRS = (OracleResultSet) tmpDS.executeQuery();
    if (tmpRS.next()) {
      tmpRS.updateString("val1", "TEST002X");
      tmpRS.updateRow();
    }
    tmpRS.close();
    tmpDS.close();
  }
}
/

-- Create PL/SQL interface.
create or replace procedure cms.OracleJdbcTestUpdate
as language java
name 'OracleJdbcTestClass.testJavaCallUpdate()';
/

-- Test code in SQL*Plus
select val1 from test_11g;
call oraclejdbctestupdate();
select val1 from test_11g;
rollback;


Changes

UTF8 based environment where database character set
select * from nls_database_parameters where parameter = 'NLS_CHARACTERSET';

reports UTF8 / AL32UTF8.

Cause

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