... for the right syntax to use near '?,?,?)' at line 1解决方案com.mysql.jdbc.exceptions.jdbc4.MySQLSynt

错误描述:
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 '?,?,?)' at line 1

原因:

1、符号错误,比如 ? ,等打成中文字符。

2、执行语句时写成如下形式:

pst.executeUpdate(sql);

占位符语句不能用带有参数的executeUpdate()方法执行。若sql语句使用写死的语句则可以使用带参的方法。

解决方案:

1、重敲错误位置的字符。

2、执行语句去掉“sql”:执行pst.executeUpdate();


发布了88 篇原创文章 · 获赞 7 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/Q_smell/article/details/81022075