Schubert Fernandes wrote:

> Hi All,
>
> I'm planning on implementing my own database connection pool for an
> upcoming project and would like your feedback. I have done some
> research on the subject, so I'm not coming into this out of thin air,
> but this is the first time I'll be doing any development on servlets so
> please be gentle. :-)
>

Just out of curiosity, why are you planning on "hiding" the connection pool
inside a servlet?  That makes it available only to the servlets in your app
that extend your DbServlet class (which leaves out, for example, JSP pages)
and would also mean that a particular app can only have one connection pool.
Some apps might need connections to two different databases.

A solution to both of these problems would be to write a separate
ConnectionPool class (or use one of the existing available ones), and store it
as a servlet context attribute.  Need it from another servlet?  No problem --
just call getServletContext().getAttribute("pool").  From a JSP?  <jsp:useBean
id="pool" ... scope="application">.  Need more than one?  Just use different
attribute names and you are all set.

Also, separating the concept of "I am a generator of HTML" (which is a
servlet's purpose in life) from the concept of "I manage a series of
connections to a database" seems like it will give you code that is easier to
re-use in your *next* application, which might not have some of the same
restrictions as your current one.

Craig McClanahan

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to