Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC ResultSet Paging[URGENT]

 
Mazhar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use the DataListHandler solution here or the Page-by-Page Iterator Pattern that is explained here
Jamie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic