You are viewing a plain text version of this content. The canonical link for it is here.
Posted to library-dev@jakarta.apache.org by Sam Ruby <ru...@us.ibm.com> on 2001/02/26 16:58:52 UTC

RE: Database connection pool scope

Another related thread.

- Sam Ruby
---------------------- Forwarded by Sam Ruby/Raleigh/IBM on 02/26/2001
11:58 AM ---------------------------





Randy Layman <ra...@aswethink.com> on 02/26/2001 11:11:17 AM

Please respond to tomcat-user@jakarta.apache.org

To:   tomcat-user@jakarta.apache.org
cc:

Subject:  RE: Database connection pool scope





     You can use static class variables as well - its just shared by all
instances.

     Why not call servlet methods?  They are just classes that you will
be using.  They are implemented as servlets for two reasons:
     1. They know they will be started at server startup if configured
correctly
     2. They know you can edit the web.xml file to configure them
(reducing the problems of where to put the config file)

     Randy


-----Original Message-----
From: sayguney@demirbank.com.tr [mailto:sayguney@demirbank.com.tr]
Sent: Monday, February 26, 2001 10:24 AM
To: tomcat-user@jakarta.apache.org
Subject: Re: Database connection pool scope



>    First of all, there are several connection pools avaiable, so you
> might want to look at those before you decide that re-inventing the wheel
is
> a good thing.

I am already evaluating some of the available products, and most probably
use one of them, thank you.

>    Second, most connection pools work by using static classes.  Your
> code would look something like:
>
>    Connection conn = ConnectionPool.getConnection();
>
> and the ConnectionPool would look something like:
>
>    public static Connection getConnection()

This sounds good, but if the class is static; then it cannot hold any data
(am I wrong?), that's why they invented the application scope in servlet
containers. A pool is basically a cache, and if you cannot hold the data
(the connection handles, timeout periods etc) it cannot re-use the
connections.

The pools I saw were implemented as servlets, and they do not get destroyed
as far as the servlet container is running. But I cannot (and don't want
to) access servlet methods from my own classes.

Any ideas?
Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, email: tomcat-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, email: tomcat-user-help@jakarta.apache.org