This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Using of Statement.setFetchSize Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using of Statement.setFetchSize" Watch "Using of Statement.setFetchSize" New topic
Author

Using of Statement.setFetchSize

RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528

While retrieving data from Oracle database facing problems. My query is returning nearly 500 records and while displaying it on the jsp page . Now if use stmt.setFetchSize(50)
how can i retreive the remaining rows??


If you want something you never had do something which you had never done
Roger Bjärevall
DbVisualizer Support
Greenhorn

Joined: Feb 19, 2009
Posts: 25
You can't. setFetchSize() cannot be used to fetch increments. Check scrollable result sets in JDBC as this seem more appropriate in your case. Another solution is to fetch all 500 rows and let JSP code control what should be presented of the cached data.

Regards

Roger
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
Thanks Roger for your explanation.

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
The setFetchSize() is just less or more a performance setting. It determines how many rows to put in memory at once. It doesn't limit the total amount of rows to be returned. There you use the SQL LIMIT and/or OFFSET clauses for, depending on the DB used. Consult its SQL documentation for details.
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
Bauke Scholtz wrote:The setFetchSize() is just less or more a performance setting. It determines how many rows to put in memory at once. It doesn't limit the total amount of rows to be returned. There you use the SQL LIMIT and/or OFFSET clauses for, depending on the DB used. Consult its SQL documentation for details.


Thanks .
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using of Statement.setFetchSize
 
Similar Threads
JSP Element mixture
A looping algorithm question?
WA #1.....word association
arrays
creating a bar graph