当我执行以下代码时,会得到一个错误。
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中执行此查询也是正确的。
发布于 2014-09-22 17:18:18
之间没有空隙
pp_alarm"+ "wher应该是...pp_alarm" + " where ...
https://stackoverflow.com/questions/25979642
复制相似问题