栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:

最近在该SSM项目遇到BadSqlGrammarException,即低级语法错误。截图如下:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: 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 'schedule
        where movie_id= 8' at line 1
### The error may exist in com/shixun/mapper/ScheduleMapper.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select count(*) form schedule         where movie_id= 8
### Cause: java.sql.SQLSyntaxErrorException: 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 'schedule
        where movie_id= 8' at line 1
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: 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 'schedule
        where movie_id= 8' at line 1
	org.springframework.web.servlet.frameworkServlet.processRequest(frameworkServlet.java:1013)
	org.springframework.web.servlet.frameworkServlet.doGet(frameworkServlet.java:897)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
	org.springframework.web.servlet.frameworkServlet.service(frameworkServlet.java:882)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)

遇到这种情况,可以采取以下思路排错:
1.检查SQL语句是否有拼写错误,比如(from,select等关键字);
2.检查是否有数据库表字段名冲突;
3.是否符合SQL基于CRUD的基本语法;

经过排查,我遇到的问题就是mybatis里面的SQL语句的from拼写错误,请各位读者引以为鉴。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/762602.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号