Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Using of Statement.setFetchSize

 
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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??

 
DbVisualizer Support
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roger for your explanation.

 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 .
 
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic