Tuesday, September 6, 2011

java.sql.SQLException: Internal - Unexpected value


Home | Profile 

Below is an error that we got while trying to run a JDBC Java  Program from a Mainframe zOS client against Oracle 11g Database. SR was logged and finally oracle concluded it as a bug - 12851493 (Refer Metalink/Oracle Support site for more details). While hunting for some leads about this error, couldn't find any helpful sites, so thought to post it here and I hope it will be of help to someone. 

Problem

java.sql.SQLException: Internal - Unexpected value
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:347)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:364)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
at java.sql.DriverManager.getConnection(DriverManager.java:322)
at java.sql.DriverManager.getConnection(DriverManager.java:358)
at TestJDBC.main(TestJDBC.java:11)

Workaround ( Suggested by Oracle Support)

Is to use the file.encoding=UTF-8 in the JVM startup or the program itself.

java -Dfile.encoding=UTF-8 TestJDBC

Environment Details

=== JDBC / JDK Driver Environment ===

Version:
java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build pmz3160sr9fp1-20110303_01(SR9 FP1))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 z/OS s390-31 jvmmz3160sr9-20110203_74623 (JIT enabled, AOT enabled)
J9VM - 20110203_074623
JIT - r9_20101028_17488ifx3
GC - 20101027_AA)
JCL - 20110203_01

Client Operating System

uname -a
OS/390 SYG1 22.00 03 2817

Database Operating System
Linux eccdb675 2.6.16.60-0.39.3-smp #1 SMP Mon May 11 11:46:34 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux

Database Version
11.2.0.2

6 comments:

  1. Thanks You help me a lot

    ReplyDelete
  2. I just had the same issue and your solution (-Dfile.encoding=UTF-8) works. I see the bug on the Oracle support site. Any idea on if they plan to actually fix it?

    ReplyDelete
  3. Thanks for posting this. I went to Oracle and found the issue immediately. In my situation, I used the old ojdbc14.jar successfully.

    ReplyDelete
  4. I just downloaded the Oracle 12c release of ojdbc6.jar from here: http://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html

    Now, instead of this:
    java.sql.SQLException: Internal - Unexpected value
    I get this!
    java.sql.SQLRecoverableException: IO Error: Undefined Error

    Oy! :-(

    ReplyDelete
  5. The "java -Dfile.encoding=UTF-8 ... " solution worked for JDK 1.7 connecting to Oracle 11g express edition. Thanks much!

    ReplyDelete