Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

using setMaxRows of PreparedStatement - Paging the records ??  RSS feed

 
Jack Nicholson
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to page the records in d/b using java.sql package.
I need 2 records on each subsequent fetch.
I got first set of records, but i could not be able to fetch next two records from d/b.
This is my program hereafter..


Thanx in advance.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36434
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The second setMaxRows is setting it to 4-2, which is two. So you are doing the same query (first two rows) repeatedly. I don't think this can be done completely in Java because not all databases support it.
There's a good article that shows how to to it in Oracle.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!