wood burning stoves 2.0*
The moose likes JDBC and the fly likes Does CallableStatement have to be closed? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

Does CallableStatement have to be closed?

Jian Yi
Ranch Hand

Joined: Feb 01, 2002
Posts: 127
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
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
Please reply to this post


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does CallableStatement have to be closed?
 
Similar Threads
How to search record on (firstname+lastname) or (lastname+firstname)? please help me
Help in DBMS_OBFUSCATION_TOOLKIT
Insert CLOB data upto 2 GB data
How to intercept a "getSession" method?
Does CallableStatement have to be closed?