Originally posted by Masoud Kalali: there are several ways , one is to use setFetchsize(), by this way you set the fetch size explicity
[/CODE]
setFetchSize does NOT affect the number of rows in the ResultSet; it affects the number of rows that are buffered by the driver. It's a performance optimization setting, not a logical operation. Some drivers default their fetch size to "all rows" and will run the JVM out of memory with a very large ResultSet, some drivers have a default fetch size of 1 and therefore spend too much time waiting on network transfers of data, some drivers have a default fetch size that is larger but may not be optimal for any particular situation (the Oracle driver has default fetch size of 10 and people usually get better performance with a higher value for the fetch size).