This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using setMaxRows of PreparedStatement - Paging the records ??

 
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
Marshal
Posts: 34071
331
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