Here are some code fragments from our servlet (we use a single dispatcher
servlet):

        public void init(ServletConfig iConfig) throws ServletException
        {
                super.init(iConfig);
                ...
                initializeDbConnectionBroker(iConfig);
                ...
        }

        private void initializeDbConnectionBroker(ServletConfig iConfig)
        {
                String dbDriver = getInitParameter("DB_DRIVER");
                String dbName = getInitParameter("DB_NAME");
                String dbUser = getInitParameter("DB_USER");
                String dbPassword = getInitParameter("DB_PSWD");
                String logfile = getInitParameter("DB_LOG_FILE");
                int initConn = new Integer(getInitParameter("DB_INITCONN")).intValue();
                int maxConn = new Integer(getInitParameter(DB_"MAXCONN")).intValue();
                int connTimeOut = new
Integer(getInitParameter("DB_CONNTIMEOUT")).intValue();
                double maxConnTime = new
Double(getInitParameter("DB_MAXCONNTIME")).doubleValue();
                try
                {
                        logMessage("Initializing DB connection pool.");
                        ConnectionPool.initialize(dbDriver, dbName, dbUser, 
dbPassword, logfile,
                                        initConn, maxConn, connTimeOut , maxConnTime);
                        logMessage("DB connection pool initialized.");
                }
                catch (Exception e)
                {
                        logException(e, this);
                        logMessage("ConnectionPool.init error:  " + e.toString());
                }
        }


public class ConnectionPool extends Object
{
        private static DbConnectionBroker myBroker = null;
        private static int connTimeOut = 0;

        public static void initialize(String DBDriver, String DBName, String
DBUser, String DBPsWd,
                                  String Logfile, int initConn, int maxConn, int 
iConnTimeOut, double
maxConnTime)
                  throws IOException
        {
                if (DBDriver != null && DBDriver.length() > 0)
                {
                        myBroker = new DbConnectionBroker(DBDriver, DBName, DBUser, 
DBPsWd,
initConn,
                                                                 maxConn, Logfile, 
maxConnTime);
                        connTimeOut = iConnTimeOut;
                }
        }

        public static synchronized DbConnectionBroker getBroker()
        {
                return myBroker;
        }

        public static synchronized void shutDown()
        {
                try
                {
                        myBroker.destroy(connTimeOut);
                }
                catch(SQLException e){}
        }
}


Jim



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf
> Of Lev Assinovsky
> Sent: Tuesday, March 05, 2002 9:10 AM
> To: Tomcat Users List
> Subject: Re: Who uses connection pool?
>
>
> Good! I just found out that  ConnectionPoolDataSource is not properly
> implemented in tyrex stuff (Tyrex people acknowledged that).
> Did  you hardcode pool instance creation or found a way when JNDI do that?
>
> Jim Urban wrote:
>
> > DBConnectionBroker
> http://opensource.devdaily.com/ddConnectionBroker.shtml
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf
> > > Of Lev Assinovsky
> > > Sent: Tuesday, March 05, 2002 7:47 AM
> > > To: Tomcat Users List
> > > Subject: Re: Who uses connection pool?
> > >
> > >
> > > Which one?
> > > Jim Urban wrote:
> > >
> > > > We do.
> > > >
> > > > Jim Urban
> > > > Product Manager
> > > > Netsteps Inc.
> > > > Suite 505E
> > > > 1 Pierce Pl.
> > > > Itasca, IL  60143
> > > > Voice:  (630) 250-3045 x2164
> > > > Fax:  (630) 250-3046
> > > >
> > > > > -----Original Message-----
> > > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf
> > > > > Of Lev Assinovsky
> > > > > Sent: Tuesday, March 05, 2002 3:09 AM
> > > > > To: 'Tomcat Users List'
> > > > > Subject: Who uses connection pool?
> > > > >
> > > > >
> > > > > Hi!
> > > > > Could you tell me please,
> > > > > does anybody successfully use database connection pool?
> > > > >
> > > > >
> > > > > --
> > > > > Lev Assinovsky                Peterlink Web
> > > > > Programmer                    St. Petersburg, Russia
> > > > > Tel/Fax: +7 812 3275343       197022 ul.Chapigina 7Á
> > > > > E-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe:
> <mailto:[EMAIL PROTECTED]>
> > > > > For additional commands:
> <mailto:[EMAIL PROTECTED]>
> > > > > Troubles with the list:
> <mailto:[EMAIL PROTECTED]>
> > > > >
> > > > >
> > > >
> > > > --
> > > > To unsubscribe:
> <mailto:[EMAIL PROTECTED]>
> > > > For additional commands:
> <mailto:[EMAIL PROTECTED]>
> > > > Troubles with the list:
> <mailto:[EMAIL PROTECTED]>
> > >
> > > --
> > > Lev Assinovsky                Peterlink Web
> > > Programmer                    St. Petersburg, Russia
> > > Tel/Fax: +7 812 3275343       197022 ul.Chapigina 7Á
> > > E-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> > > For additional commands: <mailto:[EMAIL PROTECTED]>
> > > Troubles with the list: <mailto:[EMAIL PROTECTED]>
> > >
> > >
> >
> > --
> > To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> > For additional commands: <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
> --
> Lev Assinovsky                Peterlink Web
> Programmer                    St. Petersburg, Russia
> Tel/Fax: +7 812 3275343       197022 ul.Chapigina 7Á
> E-mail: [EMAIL PROTECTED]
>
>
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to