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 JDBC ResultSet Paging[URGENT] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC ResultSet Paging[URGENT]" Watch "JDBC ResultSet Paging[URGENT]" New topic

JDBC ResultSet Paging[URGENT]


Joined: May 16, 2002
Posts: 1
Hello all,
Can anybody...give me a solution to implement paging with the Jdbc ResultSet.
I have more than a thousand record in the database table and i need to display only few records at a time.
Do we have readymade classes that does this job, maybe opensource itself.
I thank in advance for your answers.

Jeremy Bencken

Joined: Mar 10, 2003
Posts: 3
Couple ways to do this...
1) Cache your data set and hold it in memory somewhere, which avoids hitting the database for each page that you need.
2) If you have MySQL you can use SQL:
SELECT* FROM Some_Table ORDER BY Some_Column ASC LIMIT 3,5 (where 3 = the first element you want to display indexed from 0, and 5 = the number of elements you want to display).
Good luck!
IronEye SQL - JDBC Performance Analysis
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

You could use the DataListHandler solution here or the Page-by-Page Iterator Pattern that is explained here
I agree. Here's the link:
subject: JDBC ResultSet Paging[URGENT]
It's not a secret anymore!