数据库
首页 > 数据库> > SQLSyntaxErrorException: You have an error in your SQL syntax

SQLSyntaxErrorException: You have an error in your SQL syntax

作者:互联网

### The error may involve com.example.bootjdbc220620.mapper.CityMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT into city('name','state','country') 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 ''name','state','country') values('jack','actived','uk')' 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 ''name','state','country') values('jack','actived','uk')' 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 ''name','state','country') values('jack','actived','uk')' at line 1
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.29.jar:8.0.29]

是因为mapper中的inser语句中字段的引号问题导致。

标签:java,error,syntax,state,SQL,your
来源: https://www.cnblogs.com/Shieryue/p/16410628.html