Using DBCP or the connection pooling built into the Oracle JDBC driver implementation.
You should just be able to cast to the DBCP specific Connection class and from there retrieve the inner Oracle connection:
import org.apache.commons.dbcp.DelegatingConnection; DelegatingConnection dc = (DelegatingConnection)conn; OracleConnection oc = (OracleConnection)pc.getInnermostDelegate();
Note: If you are using Tomcat's built-in copy of DBCP then the import you will need is:
import org.apache.tomcat.dbcp.dbcp.DelegatingConnection;
Or you can use the connection pooling built into the Oracle JDBC driver implementation. This returns an Oracle connection. A simple setup would be:
<Resource auth="Container"
connectionCacheName="CXCACHE"
connectionCacheProperties="{MaxStatementsLimit=5,MinLimit=1, MaxLimit=1, ValidateConnection=true}"
connectionCachingEnabled="true"
description="Oracle Datasource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
name="jdbc/TestDB"
user="default_user"
password="password"
type="oracle.jdbc.pool.OracleDataSource"
url="jdbc:oracle:thin:@//localhost:1521/orcl"
/>Popular Links
Comments
Post new comment