tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Perrone <>
Subject RE: Casting a Connection as an OracleConnection in Tomcat 7
Date Tue, 29 Nov 2011 22:12:20 GMT
I did try getInnermostDelegate after casting to DelegatingConnection, but I did not set accessToUnderlyingConnectionAllowed.
I will try that tomorrow. Thanks.

-----Original Message-----
From: Christopher Schultz [] 
Sent: Tuesday, November 29, 2011 5:08 PM
To: Tomcat Users List
Subject: Re: Casting a Connection as an OracleConnection in Tomcat 7

Hash: SHA1


On 11/29/11 2:34 PM, Jason Perrone wrote:
> Has anyone yet figured out how to cast the PoolableConnection that 
> Tomcat 7 now returns when you get a Connection from a DataSource as an 
> OracleConnection?

If you are using the standard pool (which uses DBCP under the hood), I think you get use getInnermostDelegate
after casting to DelegatingConnection. That thing that gets returned should be an OracleConnection.

You also might need to set accessToUnderlyingConnectionAllowed on the DataSource in order
to actually call getInnermostDelegate. See the DBCP configuration page and look for that setting
for more info.

As always, remember to close the connection you got from the DataSource, not the inner delegate,
or you will be toast.

> In Tomcat 6 the connection was returned as T4CConnection and had no 
> problem being cast as an OracleConnection. Now, I just can't figure it 
> out. Tried using the Commons DBCP package to get native JDBC 
> connections, and every other thing I found by Googling it.

What did you actually try? What is the runtime type of the Connection object returned from
DataSource.getConnection? For me, it's BasicDataSource.

- -chris
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with Mozilla -


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

View raw message