Java.lang.ArrayIndexOutOfBoundsException: 12 With JDBC 12c (Doc ID 1906889.1)

Last updated on MARCH 23, 2016

Applies to:

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

Symptoms

Using JDBC 12c, calling refcursor fails with the following exception:


Exception occurred!
java.lang.ArrayIndexOutOfBoundsException: 12
       at oracle.jdbc.driver.DynamicByteArray.getStringFromAL16UTF16(DynamicByteArray.java:651)
       at oracle.jdbc.driver.DynamicByteArray.getString(DynamicByteArray.java:449)
       at oracle.jdbc.driver.CharCommonAccessor.getString(CharCommonAccessor.java:352)
       at oracle.jdbc.driver.GeneratedStatement.getString(GeneratedStatement.java:327)
       at oracle.jdbc.driver.GeneratedScrollableResultSet.getString(GeneratedScrollableResultSet.java:882)
       at oracle.jdbc.driver.GeneratedResultSet.getString(GeneratedResultSet.java:1460)
       at TestAIOOBE.readItem(TestAIOOBE.java:43)      
       at TestAIOOBE.main(TestAIOOBE.java:25)
END call
Connection: close

 

The program:
- creates a data source and gets a connection
- calls a package procedure with an out ref cursor parameter
- gets the result set from the out parameter
- loops through the records:
  - calls getString to get 9 column values by name and one as bytes,
    printing the results
- closes the resultset, statement and connection



This problem only reproduces with JDBC Thin; there is no error using the OCI driver.

 

Using JDBC 11.2.0.4, the program does not report the above exception, but instead the following output:

D:\testcases\JDBC\bscideas>java TestAIOOBE
Connection: getConnection
BEGIN call
???
???
????????????
null
543525976
???????
???????
null
null
1
000000 1200031789
???
???
????????????
null
543525976
???????
???????
null
null
1
000000 1200031789
END call
Connection: close

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