Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Close the CallableStatement?

843854May 16 2002 — edited Jun 13 2002
Hi guys,

I have a stored function in my Oracle DB that returns a result set through cursors. I have a bean that access this stored function and returns the ResultSet to my JSP page. Should I close the CallableStatement that I used in my bean? If I do, won't that affect the ResulSet I return to my page? If so how do I properly close everything explicitly to maintain an efficient code?

basically my code looks like this:
CallableStatement cs = con.prepareCall("{ ? = call My_Function(?)}");

cs.registerOutParameter(1, OracleTypes.CURSOR);
cs.setInt(2, Integer.parseInt(ID_num));

cs.execute();

rs = (ResultSet)cs.getObject(1);

// should I have this line? Or will it affect my rs?
cs.close();

return rs;
I figured you can't put the cs.close() after the return right?
Thanks in advance for all the help!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 11 2002
Added on May 16 2002
6 comments
255 views