MySQL Forums
Forum List  »  Connector/JDBC and Java

statement.setMaxRows() doesn't work when calling a stored procedure
Posted by: Andreas Wederbrand
Date: November 22, 2012 03:36AM

It seems that Statement doesn't honor setMaxSize() when doing calls to stored procedures. Is this a bug or a feature? Or am I mistaken?

The code below gives more than 2 rows (if any_proc() returns more).

I'm using 5.1.21 connector/j (latest?)

Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/db", "root", "root");
Statement statement = connection.createStatement();
statement.setMaxRows(2);
ResultSet resultSet = statement.executeQuery("call any_proc()");
while (resultSet.next()) {
System.out.println("got one");
}
connection.close();

Options: ReplyQuote


Subject
Written By
Posted
statement.setMaxRows() doesn't work when calling a stored procedure
November 22, 2012 03:36AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.