aspose file tools*
The moose likes JDBC 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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC ResultSet Paging[URGENT]" Watch "JDBC ResultSet Paging[URGENT]" New topic
Author

JDBC ResultSet Paging[URGENT]

Mazhar
Greenhorn

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.


d
Jeremy Bencken
Greenhorn

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.
http://www.javaworld.com/javaworld/jw-02-2001/jw-0202-cachedrow_p.html
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!
Jeremy
-------------------------------------------
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
Jamie
 
wood burning stoves
 
subject: JDBC ResultSet Paging[URGENT]