-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

> Since a number of servlets can create pools using the pool servlet, the limit
> is reached quickly.  For example, if 6 servlets create a pool each containing
a
> minimum of 10 connections, you'd need space for 60 connections.

That is why you should use a Singleton object to manage your pool. Multiple
servlets can share the same singleton.

> Actually the starting point for my pool code is the code given in Oreilly's
> servlet book.  I have modified it to handle releasing connections and killing
> pools better though.

Here is a db pool that uses the singleton approach. It works much better
imho and is easily configurable for any number of different databases.

<http://www.working-dogs.com/dash/cvsweb/index.cgi/dash/com/workingdogs/dash
/util/db/>

It works like this:

DBConnection dbc = DBConnectionFactory.getInstance().getConnection();
Connection conn = dbc.getConnection();

the beauty is that you can get a connection from anywhere in your code
without having to pass a connection object around or store the connection
cache in your servlet.

-jon


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to