Java 1.7,Commons-dbcp1.2.2 jar,JDBC
如何将java.sql.Connection类型转换为org.apache.commons.dbcp.DelegatingConnection?
Connection conn = null;
DataSource objDS = null;
objDS = (DataSource)new InitialContext().lookup("java:comp/env/jdbc/new_con");
conn = objDS.getConnection();
// Here i am getting connection fine
tempconn = ((DelegatingConnection)conn).getInnermostDelegate(); // Here it is throwing exception com.sun.proxy.$ProxyXX cannot be cast to org.apache.commons.dbcp.DelegatingConnection
oracle.sql.ArrayDescriptor desc = new oracle.sql.ArrayDescriptor("string", tempconn);
oracle.sql.ARRAY reportDataArray = new ARRAY(desc, tempconn,ipList.toArray());