MySQL 更新多列时出现语法错误

MySQL Syntax Error while updating multiple columns

我正在尝试通过 jsp 表单获取输入并使用 servlet 将其存储到 MYSQL Workbench 中的 table 来更新用户配置文件。更新 table.

时出现语法错误
ps = (PreparedStatement) con.prepareStatement("UPDATE user SET user_id =?, FName=? , LName=?,  City=? , Email=? , Country=? , DOB=?, JobPosition=?, Profile_Picture=? WHERE user_id=123");
        ps.setInt(1, UserId);
        ps.setString(2, Fname);
        ps.setString(3, Lname);
        ps.setString(4, City);
        ps.setString(5, EmailId);
        ps.setString(6, Country);
        ps.setDate(7, java.sql.Date.valueOf(DOB));
        ps.setString(8, JobPosition);
        if (inputStream != null) {
            ps.setBlob(9, inputStream);
        }

[编辑]

错误:

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 ''techquo'.'user' set user_id =123, FName='Default' , LName='Default',  City='' ,' at line 1

这是我的 SQL 查询。我对此很陌生,无法弄清楚语法有什么问题。 table 名称和属性名称是正确的。我已经复查了。任何帮助,将不胜感激。谢谢!

user 是保留关键字。请参阅文档 here

尝试用反引号将其包装起来:

ps = (PreparedStatement) con.prepareStatement("Update `user` set user_id =?, FName=? , LName=?,  City=? , Email=? , Country=? , DOB=?, JobPosition=?, Profile_Picture=?");

此外,没有 where 子句,因此更新将应用于所有行 - 可能不是您想要的。