• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet

 
Gennadiy Civil
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ronnie Ho
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34214
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic