Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet Cursor

 
Niranjan Prasad
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When query is executed,we get ResultSet

What this ResultSet actual contains?
It maintains a cursor,if it like this cursor is Current Set of Rows and so
at the client side we get excuted rows,when we say next the it fetches the
data from cursor which are in client side.

So people say ResultSet maintains rowid's of the excuted query

plse give me internals of ResultSet
 
Scott Selikoff
author
Saloon Keeper
Posts: 4014
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the internals of ResultSet is completely up to the JDBC Driver, so there's no simple answer to your question. For a lot of connections though, you can set a fetch size which will retrieve a specific number of records from the database at a given time often used to optimize network traffic. After all, its not often ideal to hit the database for each record.

Think of Google's search engine. You may have a million matches, but it only shows 10 at a time. You wouldn't want it to hit the database for every single item anymore than you'd want it to return all million records. The simple ideal solution is to return 10 (in practice this can vary precisely, as in the first record might be returned quickly and the following 9 might be grouped).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic