-
1. Re: ArrayDescriptor creation throws ClassCastException in JB
rokendo Jan 25, 2006 2:54 PM (in response to drumstick)Hi,
I've come across the same issue when trying to create a Oracle User Defined Array via the ArrayDescriptor. The issue is that the Connection object returned by Jboss is a WrappedConnection.
One possible way to resolve the issue is by doing something like the following:
WrappedConnection.getUnderlyingConnection() . This will require importing (include jboss-common-jdbc-wrapper.jar with WrappedConnection class).
A better way, which I'm looking for, is to somehow configure jboss to give me an OracleConnectionPool directly like it does in tomcat by configuring the server.xml like so:
Tomcat 5.5
name="jdbc/my_jndi_name" auth="Container" type="oracle.jdbc.pool.OracleDataSource" factory="oracle.jdbc.pool.OracleDataSourceFactory"
maxActive="20" maxIdle="10" maxWait="10000"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@my_db_url:1521:my_db" user="user" password="pw" connectionCachingEnabled="true"
Does anybody know how to configure Jboss to expliclty return an OracleDataSource? I've looked over all the jboss documentation and don't see any attribute to do something similar to the fix above for Tomcat?
Thanks in advance, -
2. Re: ArrayDescriptor creation throws ClassCastException in JB
rcdlrp Feb 5, 2007 10:44 AM (in response to drumstick)Hi!
I had the same problem in the last week, and found the solution,
The ArrayDescriptor and ARRAY needed a Native Connection, and the mode to get this is:
cstmt = (OracleCallableStatement) getSession().connection().prepareCall(" call REP_UPDATE_STOCK_WAREHOUSE(?, ?, ?, ?, ?) ");
ArrayDescriptor descCE = ArrayDescriptor.createDescriptor("NUMBER_NT", cstmt.getConnection());
A OracleCallableStatement.getConnection returns a Native Connection... use that for parameter the ArrayDescriptor.createDescriptor and the ClassCastException will solve.