Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Statement.setFetchSize is not working properly

800350Jul 22 2009 — edited Dec 23 2009
I am using setFetchSize to limit the rows returned by query.

Here is Code without using setFetchSize -
Statement stmt = dao.createStatement();
ResultSet rset = stmt.executeQuery("SELECT * FROM temp");  
while(rset.next ()) 
System.out.println( rset.getString (1) ); 
Code using setFetchSize -
Statement stmt = dao.createStatement();
stmt.setFetchSize(20);
ResultSet rset = stmt.executeQuery("SELECT * FROM temp");  
while(rset.next ()) 
System.out.println( rset.getString (1) ); 
both the code returns same result. temp has has 50 records and all records are returned in both the cases.

Edited by: seeking_solution on Jul 22, 2009 5:25 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 20 2010
Added on Jul 22 2009
14 comments
1,422 views