This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
Author

Oracle Clob error on shared Sun One connection pool

Jim Houd
Greenhorn

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 =
"SELECT TX_DATA FROM WF_DATA WHERE ID_WF_DATA = ? FOR UPDATE ";
pstmt = con.prepareStatement(updateData);
pstmt.setLong(1, idWFData);
rs = pstmt.executeQuery();
if (rs.next() == 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: http://aspose.com/file-tools
 
subject: Oracle Clob error on shared Sun One connection pool
 
Similar Threads
an example to insert data into Oracle Clob
How to read CLOB data from oracle database.
WebLogic 81 DataSource and Oracle CLOB
How to update clob field in oracle
Naming Exception happened when trying to connect to Oracle in Sun One Application Ser