When using a JDBC OCI dirver to configure EMS 5.x server with Oracle RAC clustering database, the EMS server log file may print the following Oracle error message and then stop: "SEVERE: ORA-01459: invalid length for variable character string."

When using a JDBC OCI dirver to configure EMS 5.x server with Oracle RAC clustering database, the EMS server log file may print the following Oracle error message and then stop: "SEVERE: ORA-01459: invalid length for variable character string."

book

Article ID: KB0086910

calendar_today

Updated On:

Products Versions
TIBCO Enterprise Message Service -
Not Applicable -

Description

Resolution:
Title:
When using a JDBC OCI dirver to configure the EMS 5.x server with thOracle RAC clustering database, sometimes the EMS server log file prints the following Oracle error message and stops: "SEVERE: ORA-01459: invalid length for variable character string." What is the root cause of this Oracle error message?

Resolution:
This Oracle error message: ORA-01459: invalid length for variable character string is caused by a defect in JDBC OCI Driver. You need to contact Oracle regarding this defect.

The bug information from Oracle MetaLink reference count: #6601831:
====================================================================
Bug No:    6601831
Filed    31-OCT-2007    Updated    01-DEC-2008
Product    JDBC    Product Version     10.2.0.3
Platform    Sun Solaris SPARC (64-bit)    Platform Version    No Data
Database Version    10.2.0.3    Affects Platforms     Generic
Severity    Severe Loss of Service    Status    Development to Q/A
Base Bug    N/A    Fixed in Product Version    11.2

Problem statement:

JDBC OCI DRIVER ERRORS WITH ORA-01459 DURING STANDARD BATCHING ON CALL
________________________________________
  
*** 10/31/07 08:43 am ***
.
PROBLEM:
--------
.
Invoking a stored procedure in standard batching mode raises the error
"ORA-01459: invalid length for variable character string"
only when using the JDBC-OCI driver (whereas thin does not error)
.
.
=========================    
DIAGNOSTIC ANALYSIS:
.
Reproduces only with the JDBC OCI driver.
Reproduces in 11g as well.
Tried various methods of defining connections with the same results.
.
=========================    
WORKAROUND:
.
Use JDBC Thin
.
search words
============
ORA-01459, batching
.
=========================    
RELATED BUGS:
.
NA
.
=========================    
REPRODUCIBILITY:
.
Every time with the OCI driver (except for 9.2.0)
.
.
2. List the versions in which the problem was tested:
O/s version     RDBMS       JDBC Driver      JDK Version   REPRO?
.  
Linux           11.1.0.6    11.1.0.6 OCI     1.5           YES
Linux           11.1.0.6    11.1.0.6 THIN    1.5           *NO*
Solaris         10.2.0.3    10.2.0.3 OCI     1.4.2         YES
Solaris         10.2.0.3    10.2.0.3 THIN    1.4.2         *NO*  
Solaris         10.1.0.5    10.1.0.5 OCI     1.4.2         YES
Solaris         9.2.0.8     9.2.0.8 OCI      1.4.2         Raises ORA-00900  
as written
Solaris         9.2.0.8     10.1.0.5 OCI     1.4.2         YES
.
.
=========================    
TESTCASE:
.
FILES
----------
Uploaded to bug repository
.
oci1459.java
setup.sql
readme.txt
.
JAVA SOURCE
-------------
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
public class oci1459 {
   public static void main(String[] args) {
      OracleDataSource ods = null;
      String connectString="jdbc:oracle:oci:SCOTT/TIGER@REF1023U";
      Connection c = null;
      CallableStatement s = null;
      int count1 = 1;
      int count2 = 2;
      String sql = " { call INSERT_TEST_BATCH(?,?) }";
      try {
         ods = new OracleDataSource();
         ods.setURL("jdbc:oracle:oci:@REF1023U");
         ods.setUser("SCOTT");
         c = ods.getConnection();
         //c = DriverManager.getConnection(connectString);
         s = c.prepareCall(sql);
         for (int i=0;i< count1;i++) {
            s.setInt(1,i);
            s.setInt(2,i);
            s.addBatch();
         }
         s.executeBatch();
         s.clearBatch();
         for (int i=0;i< count2;i++) {
            s.setInt(1,i);
            s.setInt(2,i);
            s.addBatch();
         }
         s.executeBatch();
   } catch (Throwable e) {
      e.printStackTrace();
   } finally {
      try {
         s.clearBatch();
         s.close();
         c.close();
      } catch (Throwable e) {
         e.printStackTrace();
      }}}}
.
SQL SOURCE (setup.sql)
-------------
create table test_batch(a number, b number);
create or replace procedure insert_test_batch(p1 number, p2 number) is
begin
    insert into test_batch(a,b) values (p1,p2);
end;
/
.
OUTPUT
-------------
java.sql.BatchUpdateException: ORA-01459: invalid length for variable  
character string
   at  
oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:
343)
   at  
t.java:10720)
   at oci1459.main(oci1459.java:39)
.
====================================
IMPACT DATE:
.
Currently impacting  
.
=============
*** 10/31/07 02:12 pm *** (CHG: Asg->NEW OWNER)
*** 11/08/07 11:08 pm *** (CHG: Confirmed Flag->Y)
*** 11/08/07 11:08 pm *** (CHG: Sta->11 Asg->NEW OWNER)
*** 11/08/07 11:08 pm ***
*** 01/24/08 02:24 pm *** (CHG: Asg->NEW OWNER)
*** 02/20/08 11:41 pm *** (CHG: Asg->NEW OWNER)
*** 06/16/08 03:47 pm ***
I have verified that the following test case, which does not depend on PLSQL,  
fails in the same way.
.
import java.sql.*;
.
public class Test{
.
  public static void main(String[] args) {
    Connection c = null;
    PreparedStatement s = null;
    Statement stmt = null;
    int count1 = 1;
    int count2 = 2;
    String sql = "insert into tab values(?, ?)";
    try {
      c = DriverManager.getConnection("jdbc:oracle:oci:@", "scott", "tiger");
      stmt = c.createStatement();
      try {
        stmt.execute("create table tab (x NUMBER(10), y NUMBER(10))");
      } catch (SQLException e) {}
      s = c.prepareCall(sql);
      for (int i=0;i< count1;i++) {
        s.setInt(1,i);
        s.setInt(2,i);
        s.addBatch();
      }
      s.executeBatch();
      s.clearBatch();
      {
        s.setInt(1,0);
        s.setInt(2,0);
        s.addBatch();
      }
      {
        s.setString(1, "1");
        s.setString(2, "1");
        s.addBatch();
      }
      s.executeBatch();
    } catch (Throwable e) {
      e.printStackTrace();
    } finally {
      try {
        s.clearBatch();
        stmt.execute("drop table tab");
        stmt.close();
        s.close();
        c.close();
      } catch (Throwable e) {
        e.printStackTrace();
      }
    }
  }
}
.
*** 06/26/08 05:04 pm *** (CHG: Comp->JDBC)
RELEASE NOTES:
]]]] JDBC OCI driver errors with ORA-01459 during standard batching call
REDISCOVERY INFORMATION:
OCI returned ORA-01459 if the two batches are executed subsequently using the s
ame statement object and the first batch size is relatively smaller than the se
cond one.  This problem only reproduces with the OCI driver.
WORKAROUND:
Close the statement object before starting the next batch.
*** 06/26/08 05:04 pm *** (CHG: Fixed->11.2)
*** 06/26/08 05:04 pm *** (CHG: Sta->80)
*** 06/27/08 05:25 am ***
*** 06/27/08 11:41 pm ***
*** 08/21/08 08:27 am ***
*** 08/21/08 08:27 am ***
*** 08/21/08 08:27 am ***
*** 08/26/08 02:29 pm ***
*** 09/16/08 11:35 pm ***
*** 09/30/08 06:46 pm ***
*** 10/01/08 02:36 pm ***
*** 10/01/08 11:32 pm ***
*** 10/03/08 04:47 am ***
*** 10/03/08 06:45 am ***
*** 10/03/08 07:28 am ***
*** 10/03/08 07:47 am ***
*** 10/03/08 05:00 pm ***
*** 10/03/08 08:35 pm ***
*** 10/11/08 12:33 am ***
*** 12/01/08 04:57 pm ***
====================================================================

Issue/Introduction

When using a JDBC OCI dirver to configure EMS 5.x server with Oracle RAC clustering database, the EMS server log file may print the following Oracle error message and then stop: "SEVERE: ORA-01459: invalid length for variable character string."