• MySQL异常:Caused by: com.mysql.jdbc.exceptions.MySQLTimeoutException: Statement cancelled due to timeout or client request


    Caused by: com.mysql.jdbc.exceptions.MySQLTimeoutException: Statement cancelled due to timeout or client request 
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2303) 
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696) 
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2105) 
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2398) 
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2316) 
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2301) 
    at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95) 
    at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251) 

     解决方法

      设置defaultStatementTimeout="60"

    在sqlmap.xml中设置,表示60s
      sqlMapConfig>

        <settings cacheModelsEnabled="false" enhancementEnabled="true" lazyLoadingEnabled="false" errorTracingEnabled="true" maxRequests="32"

          maxSessions="10" maxTransactions="5" useStatementNamespaces="true" defaultStatementTimeout="60" />


    个人配置供参考:

        <!-- basic set -->
        <settings>
          <setting name="cacheEnabled" value="true"/>
          <setting name="lazyLoadingEnabled" value="true"/>
          <setting name="multipleResultSetsEnabled" value="true"/>
          <setting name="useColumnLabel" value="true"/>
          <setting name="useGeneratedKeys" value="false"/>
          <setting name="autoMappingBehavior" value="PARTIAL"/>
          <setting name="defaultExecutorType" value="SIMPLE"/>
          <setting name="defaultStatementTimeout" value="25"/>
          <setting name="safeRowBoundsEnabled" value="false"/>
          <setting name="mapUnderscoreToCamelCase" value="false"/>
          <setting name="localCacheScope" value="SESSION"/>
          <setting name="jdbcTypeForNull" value="OTHER"/>
          <setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
          <setting name="logImpl" value="LOG4J"/>
          <setting name="callSettersOnNulls" value="true"/> 
        </settings>
    我驰骋天下,守你盛世繁华
  • 相关阅读:
    C# 利用Autofac批量接口注入依赖【学习记录】
    c# Quartzs定时器的简单使用
    Web Api 宿主的搭建
    教你如何搭建自己的直播服务器简易
    自用电脑+外网开放+SSL认证(纯免费)
    sql 获取主键表和主键的方法
    sql 分裂字符串函数
    Sql 将一个整型数字转换成带前导零的固定长度数字字符串
    sql 根据外键表和外键列得到主键表和主键列的方法
    定位div
  • 原文地址:https://www.cnblogs.com/lotuses/p/9999808.html
Copyright © 2020-2023  润新知