This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Reg: Fetch Size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Reg: Fetch Size" Watch "Reg: Fetch Size" New topic

Reg: Fetch Size

nilima komala

Joined: Mar 03, 2005
Posts: 8
Hi Friends,

What is the advantage of Fetch Size and how can it be used in programming,and how it works
Thank you in advance

Best Regards,
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
The "fetch size" refers to buffering by the driver of the rows retrieved from the database; instead of retrieving one row at a time, each time is called, the driver may choose to transfer and buffer more rows at a time. Some drivers by default will retrieve all rows in the ResultSet; this can cause unnecesarry OutOfMemory errors. Other drivers have a low default value for the fetch size; this causes slowness due to excessive netwrok transfers of the data, and setting a higher fetch size improves performance.

Fetch size is usually set with Statement.setFetchSize(); some drivers (such as Oracle) have alternate ways of setting the fetch size that can be more convenient.
I agree. Here's the link:
subject: Reg: Fetch Size
Similar Threads bottle neck
About ResultSet
db2 type 4 driver result set fetch size
Hibernate fetch size
how to fetch JSP text field value