java mysql中具有多个参数的PreparedStatement出现问题

java mysql中具有多个参数的PreparedStatement出现问题,java,mysql,jdbc,Java,Mysql,Jdbc,我使用以下代码段从select查询中检索有限数量的RAW String query="SELECT * FROM smsmessage WHERE recipient = ? LIMIT ?"; PreparedStatement prepStmt = conn.prepareStatement(query); prepStmt.setString(1,shortCode); prepStmt.setString(2,batchSize); ResultSet rs=pr

我使用以下代码段从select查询中检索有限数量的RAW

String query="SELECT * FROM smsmessage WHERE recipient = ? LIMIT ?";
   PreparedStatement prepStmt = conn.prepareStatement(query);
   prepStmt.setString(1,shortCode);
   prepStmt.setString(2,batchSize);
   ResultSet rs=prepStmt.executeQuery();
但它给了我以下问题

 ERROR {com.axiata.plugin.ReceiveSMS.ReceiveSMSNotification} -  MySQL exception   
 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 ''2'' at line 1

我的代码段有错误吗?我不能像上面那样使用多个参数吗?

LIMIT
子句需要一个
int

prepStmt.setInt(2, Integer.parseInt(batchSize));
从MySQL文档中读取(部分)


LIMIT
子句可用于约束
SELECT
语句返回的行数
LIMIT
接受一个或两个数值参数,这两个参数都必须是非负整数常量(使用准备语句时除外)


@迪纳姆先生虽然,即使你能。。。限制不是一个字符串。那么我如何才能做到这一点呢?我想通过两个普拉斯多。。。完全没有注意到这一点。