com.alibaba.druid.pool.DruidPooledConnection cannot be cast to oracle.jdbc.OracleConnection 异常解决办法(示
Posted 太白的技术博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了com.alibaba.druid.pool.DruidPooledConnection cannot be cast to oracle.jdbc.OracleConnection 异常解决办法(示相关的知识,希望对你有一定的参考价值。
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);
以上是关于com.alibaba.druid.pool.DruidPooledConnection cannot be cast to oracle.jdbc.OracleConnection 异常解决办法(示的主要内容,如果未能解决你的问题,请参考以下文章