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!