File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Java Products and Servers and the fly likes Oracle Clob error on shared Sun One connection pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Oracle Clob error on shared Sun One connection pool" Watch "Oracle Clob error on shared Sun One connection pool" New topic

Oracle Clob error on shared Sun One connection pool

Jim Houd

Joined: Oct 06, 2004
Posts: 1
I have several web applications running on a Sun Java System App Server 7
2004 Q2 that need to access a table containing session information within a Clob data type on an Oracle 9i database.
Access is via a JNDI datasource.and connection pool,(using the oracle.jdbc.pool.OracleDataSource) setup on the app server.

After getting the functionality to create and retrieve Clobs in the database working in one of the applications
(once I figured out all that silly casting jdbc Clobs to Oracle Clobs)
I discovered that I get a java.lang.ClassCastException trying to cast the jdbc Clob to an Oracle Clob when the same function (adding Clobs on the same table) is performed by a second web application accessing the SAME jndi datasource & connection pool.

The code is:

PreparedStatement pstmt = null;
ResultSet rs = null;
String updateData =
pstmt = con.prepareStatement(updateData);
pstmt.setLong(1, idWFData);
rs = pstmt.executeQuery();
if ( == false) {
throw new Exception("Error retrieving row");
oracle.sql.CLOB clob = (oracle.sql.CLOB) rs.getObject(1);

The last line above throws the ClassCastException exception when the connection pool is shared among web-apps.

I can work around it by creating a connection pool & jndi datasource for each of my web apps, but this isn't ideal since there will be many web apps, plus the overhead of each pool and datasource.

Anyone know how i can share the datasource/connection pool among web-apps and still use a single Clob table?
I agree. Here's the link:
subject: Oracle Clob error on shared Sun One connection pool
jQuery in Action, 3rd edition