Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JSP finally clause

Status
Not open for further replies.

vulcand4

Programmer
Jul 29, 2003
76
US
I have a JDBC connection pool set up and working, but if I get any kind of exception while processing my JSP, the connection can't be returned to the pool.

Is there a way to specify clean up code to occur in the finally clause in a JSP?
 
Code:
Connection conn = null;

try {
   conn = getConnection();
   // Do some SQL execution
} catch (SQLException sqle) {
    sqle.printStackTrace(System.err);
} finally {
   try {
      conn.close();
   } catch (SQLException sqle2) {
       sqle2.printStackTrace(System.err);
   }
}
 
polyGuy

Please do NOT cross-post questions with other related forums here (Tomcat forum) - it is considered bad form.
 
Sorry about the cross-post. I thought I was on the Java forum when I first posted it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top