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 Statement.setfetchSize() Doubt 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 "Statement.setfetchSize() Doubt" Watch "Statement.setfetchSize() Doubt" New topic
Author

Statement.setfetchSize() Doubt

Ravi Sree
Ranch Hand

Joined: Jan 24, 2010
Posts: 62

Hi all,

I am not fully fluent with the JDBC methods, so please guide me.
While using the methods Statement.setFetchSize(int i) or Resultset.setFetchSize(int i)
we can set the no of rows fetched at a time for all result sets of this statement.
This helps in decreasing the load on the db server. but if one has to fetch 100 rows and the fetch size is set.
how will the rest rows be fetched like...
for example i have a table 'testTable' which has a primary key Id.
when a query is executed the rows fetched will be rows till Id = 30 then next fetched rows should be from the primary key 31.
How is this understood by the db server.
I will be very grateful if some examples is provided.

Thanks in advance.
Prashant Saraf
Ranch Hand

Joined: Sep 25, 2006
Posts: 52

Check this out this may help

http://faq.javaranch.com/java/PaginationOrPaging

[moderator changed from code tag to url tag]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Statement.setfetchSize() Doubt
 
Similar Threads
Row information from ResultSet
Entity Context - how it finds its bean's primary keys?
Setting fetch size for fast retrieval of data
insert new parent/child row. How to handle new primary/foreign key inserts
Paging-Query based