com.sun.proxy。$ ProxyXX无法强制转换为org.apache.commons.dbcp.DelegatingConnection

时间:2017-01-20 07:39:47

标签: java jdbc apache-commons-dbcp

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());

0 个答案:

没有答案