<分区>
执行以下代码时出现错误。
preparedStatement = connection.prepareStatement("select * from fpp_alarm"+ "where id = ? ");
preparedStatement.setString(1, id); //string id = "4"
ResultSet resultSet = preparedStatement.executeQuery();
错误是:
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 '= '4'' at line 1.
我在这里看到了类似的问题:preparedStatement SQL Error
但是,我在我的代码中找不到 mysql 的“保留字”。在mysql中执行这个查询也是对的。