• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Oracle Data Source, WebSphere 5 ClassCastException WSJdbcResultSet

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic