473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

CLOB.createTemporary throws ClassCastException - fyi

I use websphere connection pooling and had a failure attempting a
CLOB.createTemporary.

tempClob = CLOB.createTemporary(conn, true,
CLOB.DURATION_SESSION);

Here's an excerpt of the exception and stack-trace.
java.lang.ClassCastException:
com.ibm.ejs.cm.proxy.OracleConnectionProxy
at oracle.jdbc.driver.OracleConnection.physicalConnec tionWithin
(OracleConnection.java:5128)
at oracle.sql.CLOB.createTemporary(CLOB.java:1010)
at oracle.sql.CLOB.createTemporary(CLOB.java:956)

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;
try{
stmt = conn.prepareCall("{ call DBMS_LOB.CREATETEMPORARY(?, TRUE)
}");
stmt.registerOutParameter(1, OracleTypes.CLOB);
stmt.execute();
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
1 11441
Chris,

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.

Martijn
Jul 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: freak | last post by:
hi i have problems reading an oracle(9i) clob from a php-script with the MDB-class from pear. the table files has 3 fields: id integer document clob picture clob
3
by: Jon-Paul Dobson | last post by:
Hi, We have an applet that implements the MouseListener interface but when trying to add the applet to the glasspane of another applet a classcastexception is thrown. This all seemed to work...
5
by: Casper B | last post by:
Since I am only able to pass simple beans around using my Web Service framework, I wonder how to incorporate business logic around these beans. My idea was to let my Beans be the base class and...
0
by: wqhdebian | last post by:
fils:=bfilename(directory => receiveDir,filename => fileName); dbms_lob.open(fils,dbms_lob.file_readonly); dbms_lob.createtemporary(xDoc,true); ---------------- the result is 353...
5
by: gimme_this_gimme_that | last post by:
In Oracle you can have a statement such as insert into foo (foo_id,some_clob) values (100,empty_clob()) where empty_clob() inserts a clob address. What is the approach in DB2 (8.1) to...
3
by: gupta.harika | last post by:
Hi everyone, I am a developer working on php with oracle as backend. I am facing a problem related with the CLOB data. The problem is as follows My application uses a table which contains Clob...
8
by: gimme_this_gimme_that | last post by:
I have the following Java code : package com.rhi.bb.udf.utils; import java.sql.Clob; import java.sql.SQLException; import java.util.regex.Pattern; import java.util.regex.Matcher;
1
by: bartleby | last post by:
I got the same probleme, have you fond out how to solve the problem ? -- Posted via http://dbforums.com
0
by: Chris | last post by:
I use websphere connection pooling and had a failure attempting a CLOB.createTemporary. tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION); Here's an excerpt of the exception...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.