Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle Array objects using connection pooling in Websphere

 
Prashanth menon
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I tried passing ARRAY object from java to oracle which in turn returns another array. This worked with the thin connection. But when I used Connection pooling of Websphere, this failed. Throws me out at the point where I create the ArrayDescriptor object. The Code is as follows.
String[] strArrayr={"12","13","14"};
//DATA_1_COL_TY is an oracle collection type and con is a Connection object.
ArrayDescriptor arrVarcharDesc=ArrayDescriptor.createDescriptor("DATA_1_COL_TY", con);
ARRAY arr = new ARRAY(arrVarcharDesc, connectionDb, strArrayr);
OracleCallableStatement callStmt = (OracleCallableStatement) con.prepareCall(
"{ call get_orders(?,?)}");
callStmt.setArray(1, arr);
callStmt.registerOutParameter(
2,
OracleTypes.ARRAY,
"DATA_2_COL_TY");
….
The exception raised is
java.lang.ClassCastException: com.ibm.ejs.cm.proxy.OracleConnectionProxy
Is it by any chance possible to implement the above using a connection pooling in websphere. Looks like it is possible in Oracle AS.
Thank you
Prashanth
 
Claire Zora
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have exactly the same problem. Apparently regardless of which driver you say you want to use, was always takes ibm implementations of data source & connexion pool.
For the time beeing, I have resolved this problem by bypassing was datasource declaration.
I have declared in a static block my own Oracle Datasource, binded it in JNDI and then I retrieve it later as usual.
Therefore I can use exactly the code you wrote, and all castings are fine.
This method is OK (ie it works) but I'm not totally satisfied with the "beauty of it", so if anyone has any suggestions ?...
May I had that weblogic acts axactly as Was with weblogic implementations.
Rgds,
Claire.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic