开发者

Paged retrieval of a large ResultSet

开发者 https://www.devze.com 2023-04-07 04:42 出处:网络
A database query retu开发者_如何学运维rns a large ResultSet, and I would like to page the result, something like a cursor where I can choose how many results to retrieve and then in a next loop retrie

A database query retu开发者_如何学运维rns a large ResultSet, and I would like to page the result, something like a cursor where I can choose how many results to retrieve and then in a next loop retrieve the remainders. What is the best way to do this?

Thanks


You may try javax.sql.rowset.CachedRowSet.

 CachedRowSet crs = CachedRowSetImpl();
 crs.setPageSize(100);
 crs.execute(conHandle);

 while(crs.nextPage()) {
  while(crs.next()) {
  }
 }


Do you want to display large ResultSet by multiple pages? I think may be you can use mysql syntax LIMIT.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号