• 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

Result set not showing the latest data

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a problem while retrieving the data from a table. The code gives correct result when run for the first time then if the table 'Demo' is changed using the SQL editor the subsequent retrievals give the old data and not the new one.
Can anyone reply where i have got it wrong?. Thanks in advance.

The code is given below...



 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try doing this, see it if it works:

public void retrieve()
{

ArrayList al = new ArrayList();

//....rest of your code...
 
bijoy bose
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am sorry ...
is not void but "List"
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try closing the resultset before closing the connection.
close the connection in the finally block.
 
Nikhil Menon
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Thank you bijoy bose and kalpana Kumar.

I finally solved the problem. There was no problem in the code as such, but the problem was with my sql plus (for Oracle) which was showing the data as updated even though it has not updated. Infact only that editor showed that data is updated and not the table in reality.
No wonder my code always returned the data which is actually as in the table and not as in the editor. Thank you friends once again for giving suggetions. And as you told closing the connection in the finally block that too after closing the result set is a good way to code.
Thanks a lot.

Nikhil Kanjulli Menon.
 
I don't always make ads but when I do they're tiny
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic