• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fetch data at a given record

 
Faiz Abdelhafid
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

what I should use with the Result Set, in order to obtain just the first record or any other record.

Thanks
 
Faiz Abdelhafid
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved.

Thanks
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Faiz, while it is good that you solved your problem, it would have been better if you posted the solution for the benefit of Ranchers who will run into this problem in the future.
 
Faiz Abdelhafid
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Johnson wrote:Faiz, while it is good that you solved your problem, it would have been better if you posted the solution for the benefit of Ranchers who will run into this problem in the future.


Dear Peter,

No problem !


well I was looking for a method to use with the Result Set in order to fetch records in a given order inside a Thread. The exercise is to refresh a text string every 45 sec from the database.

you can use "absolute" method to move the cursor used to fetch data to any given record inside the table.

here is the code:



Hope this will help
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might not be the best approach. The call to PreparedStatement.execute() might actually retrieve a number of records from the database and buffer them, at which point you ask for only one record. This wastes the database's time and network bandwidth. Most databases provide SQL syntax to limit the results return for a query - you would be better off using such a mechanism. One caveat though - the SQL mechanism is not database independent.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic