wood burning stoves 2.0*
The moose likes JDBC and the fly likes using setMaxRows of PreparedStatement - Paging the records ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "using setMaxRows of PreparedStatement - Paging the records ??" Watch "using setMaxRows of PreparedStatement - Paging the records ??" New topic
Author

using setMaxRows of PreparedStatement - Paging the records ??

Jack Nicholson
Ranch Hand

Joined: Sep 07, 2002
Posts: 41
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.


Jack Nicholson
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
wood burning stoves
 
subject: using setMaxRows of PreparedStatement - Paging the records ??
 
Similar Threads
why is the column data not displaying?
DatabaseMetaData API
why is the column data not displaying?
how to display list data on separate lines?
new to JDBC - please help!