File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet" Watch "Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet" New topic

Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet

Gennadiy Civil

Joined: Feb 09, 2005
Posts: 1
I have a query that causes classCast Exception when executed using Oracle data surce.
Same query runs fine with straight JDBC.

I should mention that this query gets the image from Oracle using the following code:

import oracle.jdbc.OracleResultSet;
import oracle.jdbc.OraclePreparedStatement;
conn = //getConnection
stat = conn.createStatement();
OracleResultSet rset = (OracleResultSet) stat.executeQuery(sql);;

OrdImage imageProxy =(OrdImage) rset.getCustomDatum("PROPERTY_PHOTO",


Here is the exception

Any ideas?
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
The problem lies here:

conn = //getConnection

You are getting a connection from WebSpheres connection Pool. This wraps the underlying jdbc objects with it's own.

You will need to do some investigation and determine if the WebSphere ResultSet object has any access methods to get the wrapped resultset (Oracles) and get that.
Second try configuring a different Provider for the DataSource (Oracles) check your server documentation for this.

Finally you may need to do a direct connection instead of getting it out of the pool to do this.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Ronnie Ho
Ranch Hand

Joined: Aug 10, 2005
Posts: 47
Hi Gennadiy,

Do you have a solution to the ClassCastException, I am doing exactly the same thing and getting the exact error when trying to typecast the resultSet. Thanks.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33117

Welcome to JavaRanch!

Note that the question was from six months ago and the original poster may not still be around. Can you post the code snippet throwing the exception so we can take a look at it?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet
It's not a secret anymore!