check the manual that corresponds to your MySQL server version for the right syntax to use near ‘dec

做课设微信小程序的时候,微信小程序请求后端接口,后端接口报500,
错误提示为

Declare(id=null, declareNumber=null, declareTitle=没网了, declareTime=null, declareLocal=31614, declareDescribe=网络不稳定, photo=G:\upload\2021-06-04\bf1e3f96-2c6c-4a25-bbc2-7da717a3c0c2.jpg;G:\upload\2021-06-04\cc47fb76-88a0-4dc1-86df-1c7d477a9c43.jpg, phone=13652653699, userId=1, declareTypeId=1, levelId=1, declareState=null, isDeleted=null)
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@714d5d70] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@4ca2899b] will not be managed by Spring
==>  Preparing: INSERT INTO declare ( declare_number, declare_title, declare_time, declare_local, declare_describe, photo, phone, user_id, declare_type_id, level_id, declare_state ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
==> Parameters: BX202106041632502427(String), 没网了(String), 2021-06-04 16:32:50.47(Timestamp), 31614(String), 网络不稳定(String), G:\upload\2021-06-04\bf1e3f96-2c6c-4a25-bbc2-7da717a3c0c2.jpg;G:\upload\2021-06-04\cc47fb76-88a0-4dc1-86df-1c7d477a9c43.jpg(String), 13652653699(String), 1(Integer), 1(Integer), 1(Integer), 0(Byte)
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@714d5d70]
2021-06-04 16:32:50.724 ERROR 13752 --- [nio-8088-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: 
### 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 'declare  ( declare_number,
declare_title,
declare_time,
declare_local,
declare_d' at line 1
### The error may exist in com/yeqifu/mapper/DeclareMapper.java (best guess)
### The error may involve com.yeqifu.mapper.DeclareMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO declare  ( declare_number, declare_title, declare_time, declare_local, declare_describe, photo, phone, user_id, declare_type_id, level_id, declare_state )  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 'declare  ( declare_number,
declare_title,
declare_time,
declare_local,
declare_d' 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 'declare  ( declare_number,
declare_title,
declare_time,
declare_local,
declare_d' at line 1] with root 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 'declare  ( declare_number,
declare_title,
declare_time,
declare_local,
declare_d' at line 1

我把这条插入语句放到navicat中去运行的时候,发现还是报错
在这里插入图片描述
那这肯定是sql的问题了,后面发现是我数据库表declare中有一个字段叫描述

describe ,然后发现是mysql的关键字,我就修改了这个字段,但是还是报这个错,最后发现我的表名也是关键字declare,修改表名之后就解决了这个问题。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值