File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get Data in Batches

 
Sunil K Bansal
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am building an application in whcih I want that
when I execute a query the selected rows may be 4000
transfering these rows on the network will take mmore time
I want that the first I will get the say 50 rows
if wanted value is in those 50 rows then i dont need
the rest result so I dont want the rest result should
travel the network so I can close ResultSet
if the required value is not in the first 50 rows
then i should be able to call the next 50 rows
and this process can be repeated
till the end of ResultSet
If this can be done
please help me
Bansal
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should defintiely put this in a FAQ!
The ResultSet does not contain any data! If you do a "select * from a" where a is a table with 100,000,000 rows, you do not transfer 100,000,000 rows worth of data to your program! The ResultSet is only a way to transfer data, one row at a time, from the database to your program. When you do a rs.next(), the ResultSet goes out to the database and gets a single row. So don't worry about transferring 4,000 rows from the database to your ResultSet. If the row you wanted was the 63rd row then only 63 rows will travel across the network.
Now if you'll excuse me I need to go bang my head against a wall.
 
Mark Leong
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to retrieve rows 150 to 200 with going through rows 1 to 149?
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That can't be done. If you can't figure out a solution in SQL then JDBC doesn't have a solution either.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic