I am using the following code to create a prepared statement and a streaming result set. Turns out that in some cases the result set is fairly large but I would like to close it after consuming a couple of thousand rows. However, close seems to run through all remaining results -- see this link for the definition of close: http://love.isti.com/libs/MySQL/com/mysql/jdbc/RowDataDynamic.java
statement = db.conn().prepareStatement(query, java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
db.setFetchSize(statement, kFetchSize);
I would like to close the result set (and/or statement) immediately without iterating through all the remaining results. Is that possible?
I also tried to move cursor to the end of the result set (afterLast) but that is not supported for streaming result sets. And, not using streaming result sets is not an option since result sets can sometimes be very large, and I don't want to get all of the results to the client.
thanks