Harald Ruf wrote:
Hallo,I have just upgrade my apache server from jserv to tomcat3.1.
Now my connection pool, base on a servlet(this holds the connection to
the database), doesn#t work because the 'getServlet()'-method
(ServletContext) is now deprecated and always returns null. Have
anybody another solution of connection pooling? Can anybody sen me a
code example. Thanks a lotHarald
The suggested approach is to store your connection pool object itself as
a servlet context attribute, like this:
ConnectionPool pool = new ConnectionPool( ... );
getServletContext().setAttribute("pool", pool);
Now, any servlet (or JSP page) in this web application can gain access
to the connection pool:
ConnectionPool pool =
(ConnectionPool) getServletContext().getAttribute("pool");
without needing to gain access to a servlet instance itself.
Craig McClanahan