<classpath>
<classpathentry kind="src" path="java"/>
<classpathentry kind="src" path="test"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/tomcat-trunk"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
<classpathentry kind="var" path="TOMCAT_LIBS_BASE/tomcat6-deps/dbcp/tomcat-dbcp.jar"/>
<classpathentry kind="lib" path="mysql-connector-java-5.1.6-bin.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<!-- See "build.properties.sample" in the top level directory for all -->
<property name="version.major" value="1" />
<property name="version.minor" value="0" />
- <property name="version.build" value="10" />
+ <property name="version.build" value="11" />
<property name="version.patch" value="-beta" />
<property name="version" value="${version.major}.${version.minor}.${version.build}${version.patch}" />
<!-- property values you must customize for successful building!!! -->
public Constructor getProxyConstructor() throws NoSuchMethodException {
//cache the constructor
if (proxyClassConstructor == null ) {
- Class proxyClass = Proxy.getProxyClass(ConnectionPool.class.getClassLoader(), new Class[] {java.sql.Connection.class});
+ Class proxyClass = Proxy.getProxyClass(ConnectionPool.class.getClassLoader(), new Class[] {java.sql.Connection.class,javax.sql.PooledConnection.class});
proxyClassConstructor = proxyClass.getConstructor(new Class[] { InvocationHandler.class });
}
return proxyClassConstructor;
* @version 1.0
*/
public abstract class JdbcInterceptor implements InvocationHandler {
- public static final String CLOSE_VAL = "close";
- public static final String TOSTRING_VAL = "toString";
- public static final String ISCLOSED_VAL = "isClosed";
+ public static final String CLOSE_VAL = "close";
+ public static final String TOSTRING_VAL = "toString";
+ public static final String ISCLOSED_VAL = "isClosed";
+ public static final String GETCONNECTION_VAL = "getConnection";
protected Map<String,InterceptorProperty> properties = null;
return null;
} else if (compare(TOSTRING_VAL,method)) {
return this.toString();
+ } else if (compare(GETCONNECTION_VAL,method) && connection!=null) {
+ return connection.getConnection();
}
if (isClosed()) throw new SQLException("Connection has already been closed.");
return method.invoke(connection.getConnection(),args);
--- /dev/null
+package org.apache.tomcat.jdbc.test;
+
+import java.sql.Connection;
+
+import javax.sql.PooledConnection;
+
+public class TestGetConnection extends DefaultTestCase {
+
+ public TestGetConnection(String name) {
+ super(name);
+ }
+
+ public void testGetConnection() throws Exception {
+ this.init();
+ Connection con = this.datasource.getConnection();
+ assertTrue("Connection should implement javax.sql.PooledConnection",con instanceof PooledConnection);
+ Connection actual = ((PooledConnection)con).getConnection();
+ assertNotNull("Connection delegate should not be null.",actual);
+ System.out.println("Actual connection:"+actual.getClass().getName());
+
+ }
+
+}