String query = "insert into dept values(?,'?','?'))";
PreparedStatement pu=con.prepareStatement(query);
pu.setInt(1, 2);
pu.setString(2, "a");
pu.setString(3, "ss");
pu.execute(query);
答案 0 :(得分:4)
删除问号周围的引号。
答案 1 :(得分:2)
单引号围绕占位符字符导致此错误。删除它们:
String query = "insert into dept values(?,?,?))";