peter greaves wrote:

> hi
>
> i've have my first simple JDBC servlet working and it's ok but it won't
> scale.  i read about connection pooling and looked at the global broker
> stuff, but i wondered if i could use a schema like this to make the  whole
> process more scalable.  any comments gratefully received!!!!
>

Your strategy #1 (using a Connection Manager, which is also known as a
Connection Pool) is a pretty common approach, and the one I would recommend if
the processing needs to be completed before you return to the browser.  I would
reserve worker thread strategies for cases where I wanted to initiate a
background process and return to the user, who can check on progress later on
with a separate request.

One suggestion, though -- instead of making the connection pool object a static
class, I would suggest that you make it a regular object, and store it in the
servlet context (using ServletContext.setAttribute()).  The connection pool is
still available to all servlets (and JSP pages) in a particular application,
but it is *not* available to any other code running on your server (thus
reducing the risk of accidentally or maliciously accessing your database
through the pre-authorized connections waiting in the pool).

Doing things this way also lets you run multiple applications, each with their
own connection pool, in the same server without clashing over the name of the
connection server class.

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