commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mauricio Aristizabal" <>
Subject ClassCastException obtaining wrapped oracle connection
Date Fri, 07 Jan 2005 20:26:51 GMT
Hello all,

I am trying to get the actual Oracle connection or statement from the dbcp 
pool, because I'm trying to use an oracle-specific feature 
(registerIndexTableOutParameter()), but I cannot cast the underlying 
connection even after using getInnermostDelegate() to get the wrapped 
connection.  I am using Tomcat 5.5 and whatever commons library came with 

I found this article with some helpful info:

This is what I'm doing:
OracleConnection oc = (OracleConnection) ((DelegatingConnection) 

If i break on that line my debugger shows the previous statement to return:

but I still get this exception when I continue:
java.lang.ClassCastException: oracle.jdbc.driver.OracleConnection

I've also tried to get innermost and cast statement itself:

and again, debugger indicates I have what i want:

but still exception is thrown:
java.lang.ClassCastException: oracle.jdbc.driver.OracleCallableStatement

This is what I want to do with the OracleStatement (works fine on Weblogic 
with same driver):
ostmt.registerIndexTableOutParameter(3,1000, Types.VARCHAR, 300);

Here's my context setup:
<Context path="/OfferCode" docBase="OfferCode"
debug="5" reloadable="true" crossContext="true">

<Resource name="jdbc/devdb1b" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
username="asdfasdf" password="asdf" maxActive="20" maxIdle="10"
maxWait="-1" accessToUnderlyingConnectionAllowed="true"/>
<ResourceParams name="jdbc/devdb1b">

Thanks in advance for lending us a hand.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message