C/C++教程

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语句中字段的引号问题导致。

这篇关于SQLSyntaxErrorException: You have an error in your SQL syntax的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!