zoukankan      html  css  js  c++  java
  • TransactionException: Error configuring AutoCommit

    ### Error querying database.  Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. 
    Your driver may not support getAutoCommit() or setAutoCommit(). 
    Requested setting:
    false.
    Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 57,193,128 milliseconds ago. The last packet sent successfully to the server was 57,193,128 milliseconds ago.
    is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application,
    increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

    To solve this problem you need to set the poolPingQuery and poolPingEnabled properties in the iBatis config file. For example, see lines 13-14 in code below.

     1 <?xml version="1.0" encoding="UTF-8" ?>
     2 <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
     3 <configuration>
     4 
     5   <environments default="development">
     6       <environment id="development">
     7           <transactionManager type="JDBC" />
     8           <dataSource type="POOLED">
     9               <property name="driver" value="${db.driver}" />
    10               <property name="url" value="${db.url}" />
    11               <property name="username" value="${db.user}" />
    12               <property name="password" value="${db.password}" />
    13               <property name="poolPingQuery" value="SELECT NOW()" />
    14               <property name="poolPingEnabled" value="true" />
    15           </dataSource>
    16       </environment>
    17   </environments>
    18 
    19 </configuration>

    sql消耗越小越好。

  • 相关阅读:
    lipo命令
    Eclipse安装ADT插件
    编译vo-aacenc遇到的问题
    双MIC安卓手机录音问题
    天天动听MP3解码器性能提升50%
    Sublime Text 2结合VS2010配置C C++编译
    讯飞语音语义接口测试
    讯飞语音接口注册
    iOS阶段学习第31天笔记(UINavigationBar介绍)
    iOS App上架AppStore 会遇到的坑
  • 原文地址:https://www.cnblogs.com/TomJay/p/9584798.html
Copyright © 2011-2022 走看看