Simple. Keep your Singleton Pattern usage of your connection pool.
Instead of using beans in the use:bean point it to a class that acts
as a
Handler. Your Handler will be responsible for grabbing the instance of the
Connection Pool, populating your beans with content and sending it the
results to your JSP pages.
So.... You can say to your handler. Get me the bean(s) with this
property. And the bean will be returned. If it's several beans that have
that property, then you can return a Vector of beans.
That infrastructure I just describe is working at http://www.harman.com
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Sudhir
Sent: Friday, March 17, 2000 2:48 PM
To: [EMAIL PROTECTED]
Subject: JSP and Database Connection Pool
Hi,
I am a bit new to JSP. I have good knowledge about Servlets.
Previously i wrote a servlet, which when it was invoked the first time,
it would initialize the Database Connection Pool. When ever required, i
would get a new Connection to Database (From one of the preallocated
Connections) and after i am done with the database work, i would put
back the Connection in the Pool and set it's status as available.
Since the Servlet stays in the memory after it is first invoked one, I
take advantage of that and Close all the Connections in the
ConnectionPool in the destroy() method of the main Servlet, which
actually created the Pool in the init() method.
I am trying to implement a similar concept for JSP pages. Initializing
the Connection Pool should not be a problem. I can check when a
Connection is first required check if it is null and if it is then set
up the Connection Pool.
Which is the Method where i can handling the Closing Part. Which method
is actually called in a JSP page when the Server is being Shut Down.
Can some one please help me with these. Any Methods Examples or Links
would be very helpful. Thanks in advance.
Thanks
Sudhir
[EMAIL PROTECTED]
http://www.javacommerce.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
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".
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