Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Statement and it's Fetch Size  RSS feed

Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,
I have query regarding how jdbc fetches the rows from the database. For exmaple i have a table say item in the database that contains the 1000 records and i want to retrieve these records through JDBC so code is

/*************** Dummy Code *****************************/
Connection conn = DriverManager.getConnection(url,login,pass);
Statement stmt = conn.getStatement();
ResultSet rtst = stmt.executeQuery("Select * from item ");

Now the question is that i have 1000 records in the item table and fetch value is 100(which means that 100 rows to be fetched at a time from the datbase ). So how the remaining rows cames in the memory ?

I am unable to understand how JDBC concept works as we have only call executeQuery() in the code

Thanks in advanced for your prompt answer

*** Maneesh Chauhan
author & internet detective
Posts: 38564
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you call the driver takes care of this. If there are rows cached in memory, it gives you the next row from there. When it runs out of rows in memory it gets the next X rows, stores them in memory and returns you the first one.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!