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消耗越小越好。

  • 相关阅读:
    常用正则
    存储过程里循环读取Array
    倒倒系列1
    利用HttpHandler生成静态页面
    古代人用拼音吗?
    确认Email无法复制粘贴
    C#调用OpenCV(一) 配置VS+OpenCV+Emgu cv
    ArcGIS Desktop9.3 (需要双击注册文件的破解包)在64位操作系统上的安装方法
    WebLogic console页面,localhost能登陆,IP不能登录
    javascript prototype学习(一)prototype的用处
  • 原文地址:https://www.cnblogs.com/TomJay/p/9584798.html
Copyright © 2011-2022 走看看