Yes, you should wrap it in a try catch finally construct. And return the
connection in the finally. That way, you are GUARANTEED (as long as the
server is not killed in the middle of the code) that the connection will be
returned.
It would be possible to allow the error page to return it, but then you'd
have to place the connection in the session, get it out on the error page,
and return it. Possible, but not good coding practice.
Joseph Karau
Kingland Systems
[EMAIL PROTECTED]
507-536-3629
AIM: jkara3629
-----Original Message-----
From: Marino Vittorio [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 3:24 AM
To: [EMAIL PROTECTED]
Subject: Connection pooling problem
Hi gurus, this is the typical layout of my page:
<%@ page ... errorPage="error.jsp" %>
...
<%
SQLManager myMan = SQLManager.getInstance();
Connection myConn = myMan.requestConnection();
...
...
...
myMan.returnConnection(myConn);
%>
Now, if an exception occurs after requesting a connection to the pool and
before releasing it, that connection is open and is not gonna be closed till
PoolMan timeout. In a production environment with an average of 100 active
sessions this cannot be acceptable. If a page has errors in it after a
product release, all the connection objects in the pool are gonna be open
and unusable in seconds.
Now my question: how can I handle this? Do I need to put everything in
try/catch blocks? Is there any way to pass parameters to the error page?
Thanks. Cheers, Vittorio
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets