Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet - capacity?

 
Johann Evans
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im not sure how the ResultSet class works - when you use a Statement to executeQuery(), does it execute the query to the database and then return the ENTIRE resulset into the ResultSet object, or does the ResultSet object "fetch" the record on call of the next() method?
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an implementation detail of the JDBC driver. Drivers will generally not try to read the entire result set in one go -- after all, result sets might be very large and you'd run out of memory. Most do not normally fetch one record at a time either -- the network overhead to the database server would be prohibitive. What most drivers do is download N records at a time, downloading new bunches as/when necessary. In many drivers, N is a configurable parameter. Think N = 30-100 records or so.
- Peter
[ January 13, 2003: Message edited by: Peter den Haan ]
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With Oracle, the default fetch size is 32. But you may change it using the method setFetchsize(int). There is an interesting link about it. Look for the topic "Use Blocked fetch", a little bit after the middle of the page
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic