• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

fetch data at a given record

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem solved.

Thanks
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic