Skip to Content
author's profile photo Former Member
Former Member

JDBC CLOB error

Hi,

I face the following error, i use the oracle jdbc driver as db driver and i use the same ojdbc14.jar file as the project library, but when i try to cast the clob object return from resutlset it throw me class cast exception, i did print out the class name it shown oracle.sql.CLOB, but when i cast the object to oracle.sql.CLOB it still show me the error.

Do you have any idea what is wrong?

====================// java code

import java.sql.Clob;

import oracle.sql.CLOB;

Clob clob = null;

if ( resultSet.next() )

{

clob = resultSet.getClob( 1 );

logger.debug( "resultSet.getClass() is " + resultSet.getClass() );

logger.debug( "clob.getClass() is " + clob.getClass() );

logger.debug( "clob is " + clob );

logger.debug( "(clob instanceof oracle.sql.CLOB) is " + (clob instanceof oracle.sql.CLOB));

CLOB oraClob = (CLOB)clob; // this is where the class cast exception occur

====================// log file

[10/01/2005 15:51:26] b.crrs.common.CRRSParamServlet -- DEBUG -- selectUpdateStatement is com.sap.engine.services.dbpool.wrappers.PreparedStatementWrapper@d5b222

[10/01/2005 15:51:26] b.crrs.common.CRRSParamServlet -- DEBUG -- resultSet.getClass() is class oracle.jdbc.driver.OracleResultSetImpl

[10/01/2005 15:51:26] b.crrs.common.CRRSParamServlet -- DEBUG -- clob.getClass() is class oracle.sql.CLOB

[10/01/2005 15:51:26] b.crrs.common.CRRSParamServlet -- DEBUG -- clob is oracle.sql.CLOB@1a21321

[10/01/2005 15:51:26] b.crrs.common.CRRSParamServlet -- DEBUG -- (clob instanceof oracle.sql.CLOB) is false

[10/01/2005 15:51:26] b.crrs.common.CRRSParamServlet -- DEBUG -- error

java.lang.ClassCastException

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Jan 11, 2005 at 01:52 PM
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.