File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Paging in JDBC 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Paging in JDBC 2" Watch "Paging in JDBC 2" New topic

Paging in JDBC 2

Armita Bansal

Joined: Aug 21, 2001
Posts: 8
Is there a provision for paging in JDBC2? I want to retrieve say only rows numbered 20000 to 30000 from a query which will give me a million rows.
20000-30000 records of the query
"select * from amillionrowtable"
Rob Godfrey

Joined: Aug 23, 2001
Posts: 2
The JDBC2 spec now offers the ability to jump about in the result set. See methods absolute(), relative(), previous(), first() and last() in the javadoc for java.sql.ResultSet.
Armita Bansal

Joined: Aug 21, 2001
Posts: 8
Thanks Rob..
but my question is a little different. I can set a fetch Size on the query for the first N rows. but my requirement is a range 10000-20000 row, say. what about this?
I agree. Here's the link:
subject: Paging in JDBC 2
jQuery in Action, 3rd edition