commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodney Waldhoff <>
Subject Re: [dbcp] cast connection from datasource to OracleConnection failed. connection.getDelegate() returns a oracle.jdbc.driver.T4CConnection
Date Sat, 19 Jun 2004 00:03:26 GMT
On Fri, 18 Jun 2004, Kwan Michael wrote:

> I m using Tomcat 4.1.27, oracle 9i.
> I have database pooling setup using dbcp (1.0 i
> believe comes with tomcat 4.1.27)
> so after i retrieve my datasource
> and i did the following
> Connection conn = ds.getConnection();
> System.out.println(conn.getDelegate().getClass.getName());
> I read everywhere that it is suppose to be
> OracleConnection, but it returns
> oracle.jdbc.driver.T4CConnection (not even in oracle
> javadoc)
> Anybody knows why?

getDelegate simply returns whatever your underlying connection is.  This 
will be a function of the underlying DataSource or connect string you're 

> I want to use OracleConnection because they provide
> statement caching which is not provided in dbcp 1.0.

DBCP 1.0 does in fact support PreparedStatement pooling by the way, 
although the Tomcat configuration doesn't expose a way to turn it on.  If 
you use DBCP 1.0 directly (configured via JOCL or directly through Java) 
you can enable prepared statement pooling.  It's only the DataSource 
configuration that doesn't expose it.
> I also did consider an upgrade to dbcp 1.1, 1.2 but
> the performance is not as good as the documents
> indicated (i see some performance down turn using
> basically the same settings).

That's curious.  I wonder if anyone knows why that is.

> MK

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

View raw message