我试图做一个从表中选择,这在我的数据库与其他所有表工作正常,但是当我尝试以下方法我收到一个错误:SELECT * FROM表抛出错误的JDBC
db.makeQuery("SELECT * FROM References");
的呼叫:
public ResultSet makeQuery(String query) throws Exception
{
preparedStatement = connect.prepareStatement(query);
resultSet = preparedStatement.executeQuery(query);
return resultSet;
}
然后引发以下错误:
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 'References' at line 1
我看起来很奇怪对我来说,因为这个语句的工作:
db.makeQuery("select * from Products");
是的,改变表的名字做到了。谢谢! – Medo 2012-07-05 12:18:10