Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Statement.close() will close the underlying ResultSet - Is this a guranteed behaviour ?

 
Prabhat Jha
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Statement close method will close the underlying ResultSet object. I wanted to check if this is a guranteed behaviour ?
 
Fatih Keles
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note: A Statement object is automatically closed when it is garbage collected. When a Statement object is closed, its current ResultSet object, if one exists, is also closed.

It says so.

Regards,

Fatih.
 
PrasannaKumar Sathiyanantham
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes it is a guaranteed behavior
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No it is the recommended behaviour according to the JDBC specification ie documented rather than actual behaviour.
People have gotten it wrong before, it is safer to lose the ResultSet explicitly (in my opinion)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic