java.lang.ClassCastException: com.alibaba.druid.pool.DruidPooledConnection cannot be cast to oracle.jdbc.OracleConnection
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:105)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:73)
失败原因:
The connection pool usually has a wrapper around the real connection instance, that's why your cast fails.
连接池通常包装了一个真实的真实的Connection实例。
解决方案:
Connection connection = ...; // Oracle
// 增加此代码,将Connection转换为OracleConnection
connection = connection.unwrap(OracleConnection.class);
StructDescriptor st = new StructDescriptor("T_ORDER", connection);