报错信息:
DEBUG [http-nio-8080-exec-8] - 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5]; SQL was [] for task [
### Error updating 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
### The error may involve com.bdqn.springmvc.dao.ItemsMapper.updateItemsList-Inline
### The error occurred while setting parameters
### SQL: update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ;
### 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
]
DEBUG [http-nio-8080-exec-8] - Resolving exception from handler [public java.lang.String com.bdqn.springmvc.controller.ItemsController.updatesItems(com.bdqn.springmvc.pojo.QueryVO)]: org.springframework.jdbc.BadSqlGrammarException:
### Error updating 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
### The error may involve com.bdqn.springmvc.dao.ItemsMapper.updateItemsList-Inline
### The error occurred while setting parameters
### SQL: update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ;
### 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
; 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
DEBUG [http-nio-8080-exec-8] - Resolving exception from handler [public java.lang.String com.bdqn.springmvc.controller.ItemsController.updatesItems(com.bdqn.springmvc.pojo.QueryVO)]: org.springframework.jdbc.BadSqlGrammarException:
### Error updating 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
### The error may involve com.bdqn.springmvc.dao.ItemsMapper.updateItemsList-Inline
### The error occurred while setting parameters
### SQL: update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ;
### 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
; 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
DEBUG [http-nio-8080-exec-8] - Resolving exception from handler [public java.lang.String com.bdqn.springmvc.controller.ItemsController.updatesItems(com.bdqn.springmvc.pojo.QueryVO)]: org.springframework.jdbc.BadSqlGrammarException:
### Error updating 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
### The error may involve com.bdqn.springmvc.dao.ItemsMapper.updateItemsList-Inline
### The error occurred while setting parameters
### SQL: update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ;
### 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
; 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
DEBUG [http-nio-8080-exec-8] - Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'error'; model is {error=未知异常!}
org.springframework.jdbc.BadSqlGrammarException:
### Error updating 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
### The error may involve com.bdqn.springmvc.dao.ItemsMapper.updateItemsList-Inline
### The error occurred while setting parameters
### SQL: update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ; update `items` set `name` = ? , `price` = ? where `id` = ? ;
### 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
; 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 'update `items`
set `name` = '笔记本戴尔' , `price` = 26000.0
' at line 5
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy14.update(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:254)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:54)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy20.updateItemsList(Unknown Source)
at com.bdqn.springmvc.service.impl.ItemsServiceImpl.updatesItems(ItemsServiceImpl.java:68)
at com.bdqn.springmvc.controller.ItemsController.updatesItems(ItemsController.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.logging.log4j.core.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:66)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
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:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
博主的适用处理办法:
在jdbc的配置信息上加上 &allowMultiQueries\=true (允许批量处理sql语句)。