开发者社区> 问答> 正文

java.sql.SQLRecoverableException: 关闭的语句

数据库连接池配置:
数据库链接在运行时报错: Caused by: java.sql.SQLRecoverableException: 关闭的语句 at oracle.jdbc.driver.OracleClosedStatement.exitImplicitCacheToActive(OracleClosedStatement.java:4667) at oracle.jdbc.driver.OraclePreparedStatementWrapper.exitImplicitCacheToActive(OraclePreparedStatementWrapper.java:1607) at com.alibaba.druid.util.OracleUtils.exitImplicitCacheToActive(OracleUtils.java:79) at com.alibaba.druid.pool.PreparedStatementPool.get(PreparedStatementPool.java:66) at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:326) at com.ibatis.sqlmap.engine.execution.SqlExecutor.prepareStatement(SqlExecutor.java:497) at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:75) at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteUpdate(MappedStatement.java:216) at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:94)

请问有可能是什么原因导致的这个问题??在线等

原提问者GitHub用户qiufeng6407

展开
收起
山海行 2023-07-05 21:01:48 436 0
2 条回答
写回答
取消 提交回答
  • 北京阿里云ACE会长

    这个错误可能是由于Oracle JDBC驱动程序与Druid连接池之间的兼容性问题导致的。具体来说,Oracle JDBC驱动程序在某些情况下可能会返回已经关闭的语句,而Druid连接池会对这些语句进行缓存,从而导致后续的SQL执行失败。

    为了解决这个问题,您可以尝试更新Oracle JDBC驱动程序版本,或者升级Druid连接池版本。另外,您还可以尝试调整Druid连接池的一些配置参数,以改善连接池的性能和稳定性。

    下面是一些可能有用的配置参数:

    druid.pool.removeAbandoned: 是否移除长时间未使用的连接。如果设置为true,Druid连接池会自动移除长时间未使用的连接,从而避免连接过期或者无效。

    druid.pool.removeAbandonedTimeout: 移除长时间未使用连接的超时时间。如果连接在指定的时间内没有被使用,Druid连接池会将其移除。

    druid.pool.maxEvictableIdleTimeMillis: 连接池中连接的最大空闲时间。如果连接在指定的时间内没有被使用,Druid连接池会将其移除,以避免连接过期或者无效。

    druid.pool.testOnBorrow: 是否在借用连接时测试连接的可用性。如果设置为true,Druid连接池会在借用连接时测试连接的可用性,从而避免使用无效的连接。

    2023-07-30 13:02:23
    赞同 展开评论 打赏
  • 1.0.28关闭pscache,或者升级1.0.29

    原回答者GitHub用户qiufeng6407

    2023-07-06 11:53:31
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载