zoukankan      html  css  js  c++  java
  • Caused by: java.sql.SQLException: Couldn't perform the operation getAutoCommit: You can't perform any operations on this connection. It has been automatically closed by Proxool for some reason (see lo

    系统启动,一段时间不操作,然后在来操作时,报错如下:

    Caused by: java.sql.SQLException: Couldn't perform the operation getAutoCommit: You can't perform any operations on this connection. It has been automatically closed by Proxool for some reason (see logs).
    at org.logicalcobwebs.proxool.WrappedConnection.invoke(WrappedConnection.java:207)
    at org.logicalcobwebs.proxool.WrappedConnection.intercept(WrappedConnection.java:87)
    at $java.lang.AutoCloseable$$EnhancerByProxool$$48e70053.getAutoCommit(<generated>)
    at org.hibernate.jdbc.ConnectionManager.isAutoCommit(ConnectionManager.java:212)
    at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:266)
    ... 50 more

    原因很简单:

    mysql的数据库链接的生命周期有个时间限制,超过了时间mysql会关闭连接,这个关闭操作数据库连接池是不知道的,所以使用数据库链接时需要进行测试

    修改Proxool相关配置即可:

    <!--使用前先进行测试-->
    <property name="testBeforeUse" value="true" />

    <!--使用后执行关闭操作前先进行测试-->
    <property name="testAfterUse" value="true" />

    <!--用于保持连接的测试语句 -->

    <property name="houseKeepingTestSql" value="select CURRENT_DATE" />

    <!--日志统计跟踪类型-->
    <property name="statisticsLogLevel" value="ERROR" />

    <!--表示连接的最大活动时间, 如果到某个线程的活动时间大于这个数值,将会杀掉这个线程。默认是5分钟。-->
    <property name="maximumActiveTime" value="${maximumActiveTime}" />


  • 相关阅读:
    爬取豆瓣电影
    post get 请求 headers注释哪些
    matlab 子图像subplot
    post请求get请求
    UA伪装
    urllib.request encode()/decode()
    urllib.parse quote/unquate/urlencode
    python 爬取图片
    二叉树满二叉树完全二叉树
    Linux | 性能分析系列学习 (1)
  • 原文地址:https://www.cnblogs.com/digdeep/p/8193920.html
Copyright © 2011-2022 走看看