广告
返回顶部
首页 > 资讯 > 数据库 >错误日志(.BadSqlGrammarException:错误的sql参数异常,明明参数和表中数据都对应上了,其实很简单的错误,秒解决)
  • 152
分享到

错误日志(.BadSqlGrammarException:错误的sql参数异常,明明参数和表中数据都对应上了,其实很简单的错误,秒解决)

摘要

nested exception is org.springframework.jdbc.BadsqlGrammarException 错误的sql参数异常,明明参数和表中数据都对应上了,其实很简单的错误,秒解决 { "timest

nested exception is org.springframework.jdbc.BadsqlGrammarException

错误的sql参数异常,明明参数和表中数据都对应上了,其实很简单的错误,秒解决

{
    "timestamp": "2019-12-17T02:09:41.445+0000",
    "status": 500,
    "error": "Internal Server Error",
    "message": "
### Error updating 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 "desc,class_id ) VALUES( "王权富贵",1,18,2000.0,"浩浩星河谁为主",1 )" at line 1
### The error may involve com.czxy.mapper.StudentMapper.insertSelective-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO tb_student  ( sname,gender,age,salary,desc,class_id ) VALUES( ?,?,?,?,?,? )
### 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 "desc,class_id ) VALUES( "王权富贵",1,18,2000.0,"浩浩星河谁为主",1 )" 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 "desc,class_id ) VALUES( "王权富贵",1,18,2000.0,"浩浩星河谁为主",1 )" at line 1",
    "path": "/student"
}

很简单的一个添加,报的的错是说我的sql语法有问题,检查了类里的信息,"desc,class_id"和表里的都对应上了,没问题,弄了好长时间,还是没弄出来,找班里的大神秒解决了,其实原因很简单"desc"是order里的降序排序(关键字),添加数据sql当然报语法错误

解决方案:

在@Column对应的表中数据上加上mysql的转义字符``即可

还是思维固化,想的不够灵活,没想过是字段名的问题

您可能感兴趣的文档:

--结束END--

本文标题: 错误日志(.BadSqlGrammarException:错误的sql参数异常,明明参数和表中数据都对应上了,其实很简单的错误,秒解决)

本文链接: https://www.lsjlt.com/news/3275.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作