码迷,mamicode.com
首页 > 数据库 > 详细

com.alibaba.druid.pool.DruidPooledConnection cannot be cast to oracle.jdbc.OracleConnection 异常解决办法

时间:2019-11-27 10:38:12      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:esc   key   can   hat   keyword   lib   struct   ted   cti   

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 异常解决办法

标签:esc   key   can   hat   keyword   lib   struct   ted   cti   

原文地址:https://www.cnblogs.com/zhjh256/p/11940196.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!