Can anybody spot why this code generates one of these errors?
int topQuarter = 3;
prepStmt = connection.prepareStatement("SELECT number, name, total, class FROM competitor WHERE class = 'A' ORDER BY total DESC LIMIT ?");
prepStmt.setString(1, Integer.toString(topQuarter));
rs = prepStmt.executeQuery();
java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax near ''3'' at line 1"
Note: The quotes before and after the 3 in the error are single quotes but after the 1 is a double quote.
They SQL query executes fine when I enter it directly at the mysql> command line.