JDBC Pagination
843859May 5 2010 — edited Nov 20 2014Hi,
I want to implement pagination using jdbc. The actual thing i want to know is 'How can i get first 50 and then next 50 records from database for page 1 and 2 respectively'
My Query is "Select * from data" [data table contains 20,000 rows]
For page#1 i get 50 records and for page#2 i want to get next 50 records. How can i implement it efficiently in jdbc.
I have searched and found that "rs.absolute(row)" is the way to skip first page records but it takes some amount of time on large result sets and i don't want to bear this amount of time also i dont want to use 'rownum' and 'Limit + offset' in query because these are not good to use in query, i dont know why, still i dont want to use it in query.
Can anyone help me how to get limited resultset for pagination or is there any way JDBC is giving us ?