小工具知识网

当前位置: 首页 > 行业知识 > 简单解决 Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

行业知识

简单解决 Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

2026-11-12 15:28:52 来源:互联网转载

问题描述

insert操作时莫名报错

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 'record  ( oid,number,operator,operator_describe )  VALUES  ( 28,'AS16986482811111' at line 1### The error may exist in com/xxx/xxx/order/dao/OrderOperatingRecordDao.java (best guess)### The error may involve com.xxx.xxx.order.dao.OrderOperatingRecordDao.insert-Inline### The error occurred while setting parameters### SQL: INSERT INTO order_operating record  ( oid, number, operator, operator_describe )  VALUES  ( ?, ?, ?, ? )### 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 'record  ( oid,

拷贝报错信息里的SQL去数据库执行也是报错,说明是SQL语句有问题

### SQL: INSERT INTO order_operating record  ( oid, number, operator, operator_describe )  VALUES  ( ?, ?, ?, ? )

原因分析:

查找之后发现是数据库表名有问题。正确的表名应该是order_operating_record。但是目前的表名是order_operating record少了一个下划线_


解决方案:

1、将数据库表名修改正确order_operating_record

2、将@TableName()注解表名修改正确

上一篇:csgo怎么去开服务器?

下一篇:一键刷新秘籍,刷新快捷键操作指南