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

Does CallableStatement have to be closed?

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I need to modify the following code in a way that the upper level will handle the SQLException. The original code is:

I understand that I need to move the catch block to the upper level and declare the methods with throws SQLExeption. My question is, if SQLException is thrown at the line of "val = cstmt.executeUpdate();" then it got thrown to upper level. So the cstmt never gets closed (that's what finally block is doing). I wonder if it is ok for cstmt without being closed. What could happen? Or, is it possible that when CallableStatment::executeUpdate() throws a SQLException, it closes the statement for us automatically?
Thanks a lot,
Jenny
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please reply to this post
 
    Bookmark Topic Watch Topic
  • New Topic