MySQL 报错:Translating SQLException with SQL state '42000', error code '1064', message
MySQL报错详细日志
1 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 [ 2 ### 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 3 ### The error may exist in com/xxx/insurance/dao/mapper/insurUser.xml 4 ### The error may involve insurUser.getPolicyList-Inline 5 ### The error occurred while setting parameters 6 ### 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 ?,? 7 ### 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 8 ] 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] 10 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] 11 2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager:843] - Initiating transaction rollback 12 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] 13 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] 14 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 15 2019-09-12 16:42:29 [http-nio-80-exec-25] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils:332] - Returning JDBC Connection to DataSource 16 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 17 org.springframework.jdbc.BadSqlGrammarException: 18 ### 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 19 ### The error may exist in com/xxx/insurance/dao/mapper/insurUser.xml 20 ### The error may involve insurUser.getPolicyList-Inline 21 ### The error occurred while setting parameters 22 ### 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 ?,? 23 ### 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 24 ; 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 25 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233) 26 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) 27 at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) 28 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371) 29 at com.sun.proxy.$Proxy63.selectList(Unknown Source) 30 at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198) 31 at com.xxx.insurance.dao.impl.InsurUserDAOImpl.getPolicyList(InsurUserDAOImpl.java:794) 32 at com.xxx.insurance.service.impl.MccInsurServiceImpl.getPolicyList(MccInsurServiceImpl.java:625) 33 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 34 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 35 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 36 at java.lang.reflect.Method.invoke(Method.java:498) 37 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) 38 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) 39 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) 40 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) 41 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 42 at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) 43 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 44 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) 45 at com.sun.proxy.$Proxy67.getPolicyList(Unknown Source) 46 at com.xxx.insurance.control.InsurFacadeImpl.getPolicyList(InsurFacadeImpl.java:1283) 47 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 48 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 49 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 50 at java.lang.reflect.Method.invoke(Method.java:498) 51 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) 52 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) 53 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) 54 at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:77) 55 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) 56 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) 57 at com.sun.proxy.$Proxy96.getPolicyList(Unknown Source) 58 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 59 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 60 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 61 at java.lang.reflect.Method.invoke(Method.java:498) 62 at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:302) 63 at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:217) 64 at org.springframework.remoting.caucho.HessianExporter.doInvoke(HessianExporter.java:198) 65 at org.springframework.remoting.caucho.HessianExporter.invoke(HessianExporter.java:118) 66 at org.springframework.remoting.caucho.HessianServiceExporter.handleRequest(HessianServiceExporter.java:66) 67 at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49) 68 at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) 69 at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) 70 at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669) 71 at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585) 72 at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) 73 at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 74 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) 75 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 76 at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 77 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) 78 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 79 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) 80 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 81 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) 82 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) 83 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 84 at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) 85 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 86 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521) 87 at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096) 88 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674) 89 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) 90 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) 91 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 92 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 93 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 94 at java.lang.Thread.run(Thread.java:745)
执行的 SQL:
1 <select id="getPolicyList" parameterType="map" resultType="java.util.HashMap"> 2 SELECT pii.SERIAL_NO, pii.POLICY_NUM, pii.INSUR_PRODUCT_NUM, pii.INSUR_AMOUNT, pii.STATUS, pii.TOOTH_POSITION, 3 hui.HOLDER_USER_NAME userName, hui.CREATE_TIME holderTime 4 FROM patient_insurance_info pii 5 LEFT JOIN patient_detail pd ON pii.PID = pd.PID 6 LEFT JOIN holder_user_info hui ON pd.HOLDER_ID = hui.HOLDER_ID 7 WHERE 1=1 8 AND pd.CLCODE=#{clCode} 9 <if test="currentPageNum!=null"> 10 limit #{currentPageNum},#{pageSize} 11 </if> 12 </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' 错误,可以参照上面出现这个错误的原因。
转载于:https://www.cnblogs.com/poterliu/p/11512667.html
MySQL 报错:Translating SQLException with SQL state '42000', error code '1064', message相关推荐
- SQLException SQL state [HY001] error code [1038]Out of sort memory
具体报错如下图所示 这种情况从字面上看是mysql在排序的时候内存溢出了, 具体使用了分页的操作, 每次都要进行一次的排序, 所以导致mysql内存不足的情况.多测试了几次,发现只要是添加了order ...
- react native Windows 红屏报错500 The development server returned response error code:500
react native Windows红屏报错500 -react-native run-android出现 这个内容其实很简单,这个主要是兼容的问题,因为react native 是Faceboo ...
- Mysql 报错:Incorrect string value: ‘\xE4\xBB\x98\xE6\xAC\xBE...‘ for column ‘product_pay_remark‘
1.问题: ### Error updating database. Cause: java.sql.SQLException: Incorrect string value: '\xE4\xBB\x ...
- MySQL 数据库show processlist where条件筛选报错解决方法,[Code: 1064, SQL State: 42000] You have an error in your
-- 筛选报错 show processlist where user = 'root'; -- 筛选可用 select * from information_schema.processlist w ...
- 【报错笔记】程序报错:Cause: java.sql.SQLException: Invalid value for getInt() - ‘4ab72edc-c02f-423f-ae9e-18c30
程序报错:Cause: java.sql.SQLException: Invalid value for getInt() - '4ab72edc-c02f-423f-ae9e-18c306e2cda ...
- centos7 mysql 1064_【mysql报错】1064 - You have an error in your SQL syntax;
mysql 报错1064 - You have an error in your SQL syntax;https://www.cndba.cn/debimeng/article/3198 数据库版本 ...
- 用sqoop把hdfs数据存储到mysql报错,Job job_1566707990804_0002 failed with state FAILED due to: Tas k failed
用sqoop把hdfs数据存储到mysql数据库,报错 Job job_1566707990804_0002 failed with state FAILED due to: Tas k failed ...
- SQL注入之Mysql报错注入
--志向和热爱是伟大行为的双翼. 昨天偷懒了没学什么东西,先自我反省一下 - -. 今天认真的学习了一下Mysql报错注入利用方法及原理,好久之前就像认真的学一下这个了,是在上海市大学生网络安全大赛中 ...
- MySQL报错:SQL错误[1146][42s02]: Table 'tablename' doesn't exist(记一次以为自己删库的经历)
先说一下这篇文章包含的知识点:bin_log服务查询,bin_log文件转为SQL文件,MySQL重启,MySQL磁盘不足报错,MySQL表名大小写配置 事情起因: 操作数据库的是我们的萌新妹子,不太 ...
- 【问题】连接mysql报错errorCode 0, state 08S01
[问题]连接mysql报错errorCode 0, state 08S01 解决方案 只需要加上&useSSL=false url: jdbc:mysql://localhost:3306/x ...
最新文章
- 如何得到iterator的当前元素_Java中迭代器Iterator详解
- linux 模块化编译,手把手教Linux驱动1-模块化编程 module
- 光速OFFER,为AI奔赴,商汤2022届校招提前批正式启动!
- manacher最长回文子串
- 全球500强企业人力资源管理之道
- 乐高科技系列搭建指南 pdf_近30年十辆乐高科技系列摩托车回顾_积木
- AIoT 又迎一利器,涂鸦云开发平台来了!
- FastReport.Net使用:[17]线(Line)控件使用
- 神经损伤怎么康复好 成都顾连康复医院专科专治
- silverlight图形编辑livegeometry修改
- BZOJ 2957 分块
- 大数据导论习题_2020高校邦《数据科学与大数据技术导论》课后作业习题答案...
- 爬虫---高性能爬虫
- Express中间件body-parser
- 美国弗吉尼亚大学计算机科学,美国弗吉尼亚大学计算机科学专业
- python3数据库框架_python3大框架简介 小收藏
- 高斯-约当(Gauss-Jordan)消元法
- 点菜java_java点菜系统代码
- Autodesk Inventor Professional 2022.0.1 Update Only x64
- 一文尽揽2018谷歌I/O大会:AI很酷 Android P拯救睡前玩手机综合症
热门文章
- java 数学公式解析_JAVA 文本表达式解析成数学公式,计算出结果
- JAVA调用java执行,什么结果也没有
- cmake编译时不能指定头文件路径?
- LINUX SHELL参数连接
- LINUX查看剪贴板有哪些内容
- 管理感悟:给自己编程水平打分
- VirtualBox中的WIN7开启Aero模式要谨慎
- php 字符如何与16进制数比较大小
- docker registry push 覆盖_Maven一键部署Springboot到Docker仓库,为自动化做准备
- phpstudy mysql 漏洞_phpstudy后门漏洞复现php5.2