2 qq 34654085 qq_34654085 于 2018.02.14 11:54 提问

HTTP Status 500 - Request processing failed; 5C

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is 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 'select group_concat(distinct

concat(
  'max(if(cname = ''',cname,
  ' at line 2

The error may exist in file [UsercourseMapping.xml]

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: set @sql = null; select group_concat(distinct concat( 'max(if(cname = ''',cname, ''', score, 0)) as ''', cname, '''' ) ) into @sql from usercourse; set @sql = concat('select uid as 学号, uname as 姓名,sum(score) as 总分, ', @sql, ' from usercourse where bid=1 group by uid '); prepare stmt from @sql; execute stmt; deallocate prepare stmt;

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 'select group_concat(distinct

concat(
  'max(if(cname = ''',cname,
  ' at line 2

; 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 'select group_concat(distinct
concat(
'max(if(cname = ''',cname,
' at line 2
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:963)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:842)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:827)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:91)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)

4个回答

devmiao
devmiao   Ds   Rxr 2018.02.17 22:53

sql语法错误

SQL: set @sql = null; select group_concat(distinct concat( 'max(if(cname = ''',cname, ''', score, 0)) as ''', cname, '''' ) ) into @sql from usercourse; set @sql = concat('select uid as 学号, uname as 姓名,sum(score) as 总分, ', @sql, ' from usercourse where bid=1 group by uid '); prepare stmt from @sql; execute stmt; deallocate prepare stmt;

参数问题

bky_lb
bky_lb   2018.02.14 12:28

UsercourseMapping.xml文件里面的有一句SQL语句写错了。

bky_lb
bky_lb 回复张小北2: 你可以把那一句SQL贴出来看下,你截的错误日志里面看不清楚
3 个月之前 回复
qq_41737500
qq_41737500 .
3 个月之前 回复
qq_41737500
qq_41737500 .
3 个月之前 回复
qq_34654085
qq_34654085 咋解决 我知道 有错误关键是 Navicate 可以执行出来
3 个月之前 回复
weixin_40721041
weixin_40721041   2018.02.14 20:07

UsercourseMapping.xml有一句SQL语句错了。

we82206307
we82206307   2018.02.14 12:03

你的sql有一个错误You have an error in your SQL syntax

qq_34654085
qq_34654085 我知道 有错 但是 在Navicate 里面能正常执行 出来 到了 Mapping.xml 就错了 不知道怎么解决
3 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!