Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading Records One by One

 
Michael.H.Sun
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
How can I read records one by one from a table in a database? My code reads the whole table at once. Your suggestion is greatly appreciated.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may be wrong, don't think your code really reads all the results at once. Not if you use JDBC, anyway.
When you get a ResultSet back from a query, you have only the "next" nethod to advance to the next result. You have to do this repeatedly until you have got enough (or all) results. The ResultSet is free to trickle the results back if it wants to, each call to "next" will just block if the results are back from the database yet.
Whether this actually happens or not, is up to whoever implemented your database and database driver.
 
Michael.H.Sun
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Frank for your answer.
 
Raja Shekhar
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hi all,
"GOOD Discussion @ wrong PLACE "

Raj
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!