aspose file tools*
The moose likes JDBC 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
Bookmark "Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet" Watch "Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet" New topic
Author

Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet

Gennadiy Civil
Greenhorn

Joined: Feb 09, 2005
Posts: 1
Hello:
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.ord.im.OrdImage;
import oracle.jdbc.OracleResultSet;
import oracle.jdbc.OraclePreparedStatement;
.....
conn = //getConnection
stat = conn.createStatement();
OracleResultSet rset = (OracleResultSet) stat.executeQuery(sql);
rset.next();

OrdImage.getORADataFactory());
OrdImage imageProxy =(OrdImage) rset.getCustomDatum("PROPERTY_PHOTO",
OrdImage.getFactory());

rset.close();

Here is the exception
java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet

Any ideas?
Thanks
Carl Trusiak
Sheriff

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
Marshal

Joined: May 26, 2003
Posts: 30929
    
158

Ronnie,
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?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
wood burning stoves
 
subject: Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet