aspose file tools*
The moose likes JDBC and the fly likes What hapens internally when i execute rs.next() or when I receive multiple resultsets? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "What hapens internally when i execute rs.next() or when I receive multiple resultsets?" Watch "What hapens internally when i execute rs.next() or when I receive multiple resultsets?" New topic
Author

What hapens internally when i execute rs.next() or when I receive multiple resultsets?

Subhani Sk
Greenhorn

Joined: Oct 04, 2003
Posts: 5
As per the info. i got from Net,

It depends on the driver implementation. It may go back to database and fetch the next row.
Or all data may come and sit inside the Java memory as objects and can be served.

I have questions on these too... If we go back and forth again and again, it is costly and time consuming operation.
On the otherhand, i twe kepp inside the memory, it may consume all memory and no space for the remaining objects.
In production, there might be chances that because of above reason, we may get lot of 'OutOfMemoryException', is not it?

How doe sit handles in realty. We are using DB2 type 2 driver.
When I try to move across result sets, what happens then?

Please share your thoughts.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

It depends on the driver. Most databases will fetch a certain number of rows (which you can change) at a time and keep those in memory. Then they will go to the database to get the next group.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What hapens internally when i execute rs.next() or when I receive multiple resultsets?