项目中一条很简单的select 语句:select coulmn1,coulmn2,coulmn3 from table where coulmn1 != 2;
一直都没有问题,table中也就20来条数据,今天项目启起来忽然出现:
org.springframework.dao.RecoverableDataAccessException:
Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 1,000,128 milliseconds ago. The last packet sent successfully to the server was 1,000,129 milliseconds ago.
The error may exist in URL [jar:file:/D:/IDEA%20work/yohobuy-crm/web/target/yohobuy-crm-web/WEB-INF/lib/yohobuy-crm-dal-1.0.0-SNAPSHOT.jar!/META-INF/mybatis/PushTemplateMapper.xml]
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: SELECT content_type, push_template_id, push_template_title, push_template_content, push_template_herf, status, create_time, update_time, create_user_id,model_type,model_param FROM push_template WHERE status!=2
Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 1,000,128 milliseconds ago. The last packet sent successfully to the server was 1,000,129 milliseconds ago.
; SQL []; Communications link failure
The last packet successfully received from the server was 1,000,128 milliseconds ago. The last packet sent successfully to the server was 1,000,129 milliseconds ago.; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 1,000,128 milliseconds ago. The last packet sent successfully to the server was 1,000,129 milliseconds ago.
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:98)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy20.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy76.selectAllPushTemplate(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
然后我把这句sql改成: select coulmn2, coulmn1,coulmn3 from table where e coulmn1
!= 2就可以。就是说这句sql稍微一点点改动就行,就是原来的不行,没理由啊,这是什么原因啊,大侠们有遇到的的吗?在线等!