Java.lang.ClassCastException: Javax.sql.rowset.serial.SerialClob Cannot Be Cast To Oracle.sql.CLOB Is Reported While Passing A SerialClob Object As Parameter In The setClob Method Of A Statement

(Doc ID 2024807.1)

Last updated on JUNE 30, 2015

Applies to:

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

Symptoms

On : 11.2.0.4.0 version, Thin JDBC driver

When attempting to insert a Clob into the database using the next code:


the following error occurs:


ERROR
-----------------------
java.lang.ClassCastException: javax.sql.rowset.serial.SerialClob cannot be cast to oracle.sql.CLOB
at oracle.jdbc.driver.OraclePreparedStatement.setClobInternal(OraclePreparedStatement.java:6716)
at oracle.jdbc.driver.OracleCallableStatement.setClob(OracleCallableStatement.java:4849)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setClob(OraclePreparedStatementWrapper.java:160)
at test.db.oracle.TestPassClob.run(TestPassClob.java:34)
at test.runner.Run.main(Run.java:36)



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