By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,291 Members | 3,096 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,291 IT Pros & Developers. It's quick & easy.

CLOB.createTemporary throws ClassCastException - fyi

P: n/a
I use websphere connection pooling and had a failure attempting a

tempClob = CLOB.createTemporary(conn, true,

Here's an excerpt of the exception and stack-trace.
at oracle.jdbc.driver.OracleConnection.physicalConnec tionWithin
at oracle.sql.CLOB.createTemporary(
at oracle.sql.CLOB.createTemporary(

I replaced the CLOB.createTemporary statement with the following code.
This worked around the CLOB.createTemporary failing. Hopefully this
helps you if you have the same problem.
CallableStatement stmt = null;
stmt = conn.prepareCall("{ call DBMS_LOB.CREATETEMPORARY(?, TRUE)
stmt.registerOutParameter(1, OracleTypes.CLOB);
tempClob = (CLOB)stmt.getObject(1);
} finally {
if ( stmt != null ) {
try {stmt.close();} catch (Throwable e) {}
// Be sure to do a tempClob.freeTemporary() after you're done with
it (i.e., inserted or updated a column with it).
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply

P: 1

I have seen this "fenomenon" (ClassCast when getting a tempClob) a lot of times, and have seen some handy solutions to it (some having to do with Log4J-settings, can you believe it, others with OPAQUE-stuff). But I must admit that your solution is by far the most elegant. I am rewriting my code right this instant. Thank you for sharing your code with us.

Kudos for Chris.

Jul 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.