MySQL报错详细日志

 2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator:399] - Translating SQLException with SQL state '42000', error code '1064', message [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10'' at line 9]; SQL was [] for task [
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10'' at line 9
### The error may exist in com/xxx/insurance/dao/mapper/insurUser.xml
### The error may involve insurUser.getPolicyList-Inline
### The error occurred while setting parameters
### SQL: SELECT pii.SERIAL_NO, pii.POLICY_NUM, pii.INSUR_PRODUCT_NUM, pii.INSUR_AMOUNT, pii.STATUS, pii.TOOTH_POSITION, hui.HOLDER_USER_NAME userName, hui.CREATE_TIME holderTime FROM patient_insurance_info pii LEFT JOIN patient_detail pd ON pii.PID = pd.PID LEFT JOIN holder_user_info hui ON pd.HOLDER_ID = hui.HOLDER_ID WHERE 1=1 AND pd.CLCODE=? limit ?,?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10'' at line 9
]
2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.mybatis.spring.SqlSessionUtils:287] - Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3a52c61e]
2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.mybatis.spring.SqlSessionUtils:292] - Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3a52c61e]
2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager:843] - Initiating transaction rollback
2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager:279] - Rolling back JDBC transaction on Connection [jdbc:mysql://127.0.0.1:3306/chubb_2?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true, UserName=root@localhost, MySQL-AB JDBC Driver]
2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils:222] - Resetting read-only flag of JDBC Connection [jdbc:mysql://127.0.0.1:3306/chubb_2?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true, UserName=root@localhost, MySQL-AB JDBC Driver]
2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager:322] - Releasing JDBC Connection [jdbc:mysql://127.0.0.1:3306/chubb_2?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true, UserName=root@localhost, MySQL-AB JDBC Driver] after transaction
2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils:332] - Returning JDBC Connection to DataSource
2019-09-12 16:42:29 [http-nio-80-exec-25] WARN [org.springframework.remoting.support.RemoteInvocationTraceInterceptor:87] - Processing of HessianServiceExporter remote call resulted in fatal exception: com.xxx.insurance.control.InsurFacade.getPolicyList
org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10'' at line 9
### The error may exist in com/xxx/insurance/dao/mapper/insurUser.xml
### The error may involve insurUser.getPolicyList-Inline
### The error occurred while setting parameters
### SQL: SELECT pii.SERIAL_NO, pii.POLICY_NUM, pii.INSUR_PRODUCT_NUM, pii.INSUR_AMOUNT, pii.STATUS, pii.TOOTH_POSITION, hui.HOLDER_USER_NAME userName, hui.CREATE_TIME holderTime FROM patient_insurance_info pii LEFT JOIN patient_detail pd ON pii.PID = pd.PID LEFT JOIN holder_user_info hui ON pd.HOLDER_ID = hui.HOLDER_ID WHERE 1=1 AND pd.CLCODE=? limit ?,?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10'' at line 9
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10'' at line 9
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy63.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198)
at com.xxx.insurance.dao.impl.InsurUserDAOImpl.getPolicyList(InsurUserDAOImpl.java:794)
at com.xxx.insurance.service.impl.MccInsurServiceImpl.getPolicyList(MccInsurServiceImpl.java:625)
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:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy67.getPolicyList(Unknown Source)
at com.xxx.insurance.control.InsurFacadeImpl.getPolicyList(InsurFacadeImpl.java:1283)
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:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:77)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy96.getPolicyList(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:498)
at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:302)
at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:217)
at org.springframework.remoting.caucho.HessianExporter.doInvoke(HessianExporter.java:198)
at org.springframework.remoting.caucho.HessianExporter.invoke(HessianExporter.java:118)
at org.springframework.remoting.caucho.HessianServiceExporter.handleRequest(HessianServiceExporter.java:66)
at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

执行的 SQL:

 <select id="getPolicyList" parameterType="map" resultType="java.util.HashMap">
SELECT pii.SERIAL_NO, pii.POLICY_NUM, pii.INSUR_PRODUCT_NUM, pii.INSUR_AMOUNT, pii.STATUS, pii.TOOTH_POSITION,
hui.HOLDER_USER_NAME userName, hui.CREATE_TIME holderTime
FROM patient_insurance_info pii
LEFT JOIN patient_detail pd ON pii.PID = pd.PID
LEFT JOIN holder_user_info hui ON pd.HOLDER_ID = hui.HOLDER_ID
WHERE 1=1
AND pd.CLCODE=#{clCode}
<if test="currentPageNum!=null">
limit #{currentPageNum},#{pageSize}
</if>
</select>

报错原因:

传入到 mybatis 的 参数类型为 Map paramMap ,但是在 Controller 层只是将 currentPageNum 转为了整数类型,没有将 pageSize 转为整数类型,pageSize 默认值为 10,所以才会在上面的报错信息第一行中出现如下信息:

Translating SQLException with SQL state '42000', error code '1064', message [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10'' at line 9]

MySQL 的 limit 后面必须要传两个整数,否者就会报这个错。

解决方案:

将 currentPageNum 和 pageSize 转为整数传入。

PS:还有可能是其他问题导致出现相同 error code '1064' 错误,可以参照上面出现这个错误的原因。

MySQL 报错:Translating SQLException with SQL state '42000', error code '1064', message的更多相关文章

  1. 线上问题 - MySQL SQL state [HY000]; error code [1366]

    一.问题描述 另外一个系统调用服务接口api:/xxx/create?aName=&time=&...,数据没有保存成功提示SQL state [HY000]; error code ...

  2. [Error]Python虚拟环境报错 OSError: setuptools pip wheel failed with error code 2

    mkvirtualenv py35 python新建虚拟环境报错,setuptools pip wheel failed with error code 2 刚好昨天在CentOS安装的时候也总是报s ...

  3. MySQL报错:Cause: java.sql.SQLException: Incorrect string value: '\xE6\x9D\xA8","...' for column 'obj_value' at row 1

    1.插入MySQL表时,报错:Cause: java.sql.SQLException: Incorrect string value: '\xE6\x9D\xA8","...' ...

  4. Linux 安装软件报错 Sub-process /usr/bin/dpkg returned an error code (1)

    Linux 通过 apt-get 安装软件时报错,换一个软件安装也一样. Errors were encountered while processing: blueman E: Sub-proces ...

  5. python pip安装报错python setup.py egg_info failed with error code 1

    安装locust遇到点问题折腾了好一会儿,记录一下. 使用命令pip install locustio提示python setup.py egg_info  failed with error cod ...

  6. mysql报错:Cause: java.sql.SQLException: sql injection violation, syntax error: ERROR. pos 39, line 2, column 24, token CLOSE

    因为close是mysql关键字 -- ::, DEBUG (BaseJdbcLogger.java:)- ==> Preparing: , -- ::, INFO (XmlBeanDefini ...

  7. hibernate查询oracle数据库表报错SQL state [null]; error code [17027]; 流已被关闭; nested exception is java.sql.SQLException: 流已被关闭

    把表字段类型 long 修改为 number类型即可

  8. uncategorized SQLException for SQL []; SQL state [99999]; error code [17004]; 无效的列类型: 1111; nested exception is java.sql.SQLException: 无效的列类型: 1111

    WHERE 的条件取值时添加上jdbcType=NUMBER这样的配置 参考[1]:https://blog.csdn.net/fyhjuyol/article/details/45483167

  9. SQL state [72000]; error code [1461]; ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值 ; nested exception is java.sql.BatchUpdateException: ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值

    本文转自  https://www.cnblogs.com/yingsong/p/5685790.html 原 因:某一个字段本为varchar2(1024),但是实际要插入的值超过varchar2允 ...

随机推荐

  1. Java A*算法搜索无向图最短路径

    网上看了很多别人写的A*算法,都是针对栅格数据进行处理,每次向外扩展都是直接八方向或者四方向,这样利于理解.每次移动当前点,gCost也可以直接设置成横向10斜向14. 但是当我想处理一个连续的数据集 ...

  2. Java学习之程序运行机制

    Java的运行机制是:先编译,后解释. 典型的编译型编程语言是:C和C++. eg:用c语言编写的*.c文件编译生成*.h文件,通过链接将*.h文件链接成*.exe文件,然后就可以运行,编译型的高级语 ...

  3. html自定义分页

    public class MyPager { /// <summary> /// 每一页数据的条数 /// </summary> public int PageSize { g ...

  4. win7 删除多余启动项的方法

    win7已经没有像xp那么简单的boot.ini让我们修改了,取而代之的是bcdedit.现在就简单的说下bcdedit的常规应用吧.开始,运行,输入bcdedit /?可以看到帮助.简单的应用开始. ...

  5. Jmeter 录制脚本【转】

    Jmeter 录制脚本[转] Jmeter中有2种方法可以录制脚本.  不过我个人非常不推荐录制脚本,录制的脚本混乱,需要再次加工才能使用. 像我这么精通HTTP协议的人. 一直都是使用Fiddler ...

  6. form表单简易注册登陆

    注册页面: html <form action="updata.php" method="post" id="text_form"&g ...

  7. Android之LinearLayout线性布局

    1.相关术语解释 orientation 子控件的排列方式,horizontal(水平)和vertical(垂直默认)两种方式! gravity 子控件的对齐方式,多个组合 layout_gravit ...

  8. python用reduce和map把字符串转为数字的方法

    python用reduce和map把字符串转为数字的方法 最近在复习高阶函数的时候,有一道题想了半天解不出来.于是上午搜索资料,看了下别人的解法,发现学习编程,思维真的很重要.下面这篇文章就来给大家介 ...

  9. Unity IoC Base On MVC

    Unity框架,是一个经典的IoC模式实现方式,其通过config文件配置section,将接口与实现解藕,config中的section配置的container以全名称对应,使得应用程序无需像Nin ...

  10. hdfs写并发问题

    hdfs文件写入不支持多个进程同时写入一个文件,每次只能一个FS挟持对象的人写入