• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Result set not showing the latest data

 
Nikhil Menon
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • 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...



 
bijoy bose
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
i am sorry ...
is not void but "List"
 
kalpana Kumar
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic