You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Pablo Morillas <pa...@sortes.com> on 2001/10/03 00:07:28 UTC

Pool connection to database

Hello all.

I have a problem that I suppose is resolved by Tomcat. I'm using Tomcat 3.2
and I can connect to an Oracle 8i database. The problem is that a process is
created by oracle in any connection to the database done from mines
servlets. I want to use a pool of connection for limit the number of
connection actives.
Is there any way to specify a class that run when I start tomcat? If I have
any pool connection running inside tomcat I think that I will get the pool,
won't I?

Thanks to all in advance.

==================================
Pablo Morillas
http://www.sortes.com
pablo@sortes.com
==================================


Re: Pool connection to database

Posted by Pablo Morillas <pa...@sortes.com>.
OK.

I think that I am understood what have I do to resolve it. I have to put a
ConnectionPool object in the system properties hash table and I will get a
connection pooled enviroment for mines servlets, jBeans and JSP's.

Thanks for your help.

==================================
Pablo Morillas
http://www.sortes.com
pablo@sortes.com
==================================
----- Original Message -----
From: "Héctor Pérez" <he...@hotmail.com>
To: <to...@jakarta.apache.org>
Sent: Wednesday, October 03, 2001 7:04 AM
Subject: RE: Pool connection to database


> You must enclose de Connection Pool within a class with one object: the
> Pool.
> The Pool must be a variable within this class and when you call a specific
> method, if this variable is null, you create the pool, in the others cases
> you ask for a connection from the pool.
> The method you use must be proctected by sincronized clause, because this
> variable may be accesed by multiple objects or threads.
> It's clear?.
> I use this methodology and it works fine. Now you may use your connection
> pool in what ever you like: jsp, servlets, etc.
>
>
>
> ----- Original Message -----
> From: Jacob FanChiang (??) <ja...@cht.com.tw>
> To: <to...@jakarta.apache.org>
> Sent: Tuesday, October 02, 2001 10:55 PM
> Subject: Re: Pool connection to database
>
>
> > Hi:
> > You can put it in tomcat use
> > "
> > System.getProperties().put(key,value);
> > System.getProperties().getProperty(key);
> > "
> > Here is my solution.
> > I create the connections in constructor "ConnectionPool()".
> > I  new  the ConnectionPool instance in where I need to use it.
> > "
> > ConnectionPool dbPool = new ConnectionPool();
> >  Connection c = dbPool.getConnection();
> > "
> >
> > Jacob FanChiang
> >
> > >From Taiwan
> >
> > Assoiciate Researcher
> > Customer Care and Billing System Dept.
> > Telecommunication Laboratories
> > Chunghwa Telecom Co., Ltd.
> > Tel: +886 2 3707 1098
> > Fax +886 2 2325 5844
> > Email: jacob@cht.com.tw
> > ----- Original Message -----
> > From: "Pablo Morillas" <pa...@sortes.com>
> > To: <to...@jakarta.apache.org>
> > Sent: Wednesday, October 03, 2001 6:07 AM
> > Subject: Pool connection to database
> >
> >
> > > Hello all.
> > >
> > > I have a problem that I suppose is resolved by Tomcat. I'm using
Tomcat
> > 3.2
> > > and I can connect to an Oracle 8i database. The problem is that a
> process
> > is
> > > created by oracle in any connection to the database done from mines
> > > servlets. I want to use a pool of connection for limit the number of
> > > connection actives.
> > > Is there any way to specify a class that run when I start tomcat? If I
> > have
> > > any pool connection running inside tomcat I think that I will get the
> > pool,
> > > won't I?
> > >
> > > Thanks to all in advance.
> > >
> > > ==================================
> > > Pablo Morillas
> > > http://www.sortes.com
> > > pablo@sortes.com
> > > ==================================
> > >
> >
> >


RE: Pool connection to database

Posted by Héctor Pérez <he...@hotmail.com>.
You must enclose de Connection Pool within a class with one object: the
Pool.
The Pool must be a variable within this class and when you call a specific
method, if this variable is null, you create the pool, in the others cases
you ask for a connection from the pool.
The method you use must be proctected by sincronized clause, because this
variable may be accesed by multiple objects or threads.
It's clear?.
I use this methodology and it works fine. Now you may use your connection
pool in what ever you like: jsp, servlets, etc.



----- Original Message -----
From: Jacob FanChiang (??) <ja...@cht.com.tw>
To: <to...@jakarta.apache.org>
Sent: Tuesday, October 02, 2001 10:55 PM
Subject: Re: Pool connection to database


> Hi:
> You can put it in tomcat use
> "
> System.getProperties().put(key,value);
> System.getProperties().getProperty(key);
> "
> Here is my solution.
> I create the connections in constructor "ConnectionPool()".
> I  new  the ConnectionPool instance in where I need to use it.
> "
> ConnectionPool dbPool = new ConnectionPool();
>  Connection c = dbPool.getConnection();
> "
>
> Jacob FanChiang
>
> >From Taiwan
>
> Assoiciate Researcher
> Customer Care and Billing System Dept.
> Telecommunication Laboratories
> Chunghwa Telecom Co., Ltd.
> Tel: +886 2 3707 1098
> Fax +886 2 2325 5844
> Email: jacob@cht.com.tw
> ----- Original Message -----
> From: "Pablo Morillas" <pa...@sortes.com>
> To: <to...@jakarta.apache.org>
> Sent: Wednesday, October 03, 2001 6:07 AM
> Subject: Pool connection to database
>
>
> > Hello all.
> >
> > I have a problem that I suppose is resolved by Tomcat. I'm using Tomcat
> 3.2
> > and I can connect to an Oracle 8i database. The problem is that a
process
> is
> > created by oracle in any connection to the database done from mines
> > servlets. I want to use a pool of connection for limit the number of
> > connection actives.
> > Is there any way to specify a class that run when I start tomcat? If I
> have
> > any pool connection running inside tomcat I think that I will get the
> pool,
> > won't I?
> >
> > Thanks to all in advance.
> >
> > ==================================
> > Pablo Morillas
> > http://www.sortes.com
> > pablo@sortes.com
> > ==================================
> >
>
>

Re: Pool connection to database

Posted by "Jacob FanChiang (范姜)" <ja...@cht.com.tw>.
Hi:
You can put it in tomcat use
"
System.getProperties().put(key,value);
System.getProperties().getProperty(key);
"
Here is my solution.
I create the connections in constructor "ConnectionPool()".
I  new  the ConnectionPool instance in where I need to use it.
"
ConnectionPool dbPool = new ConnectionPool();
 Connection c = dbPool.getConnection();
"

Jacob FanChiang

>>From Taiwan

Assoiciate Researcher
Customer Care and Billing System Dept.
Telecommunication Laboratories
Chunghwa Telecom Co., Ltd.
Tel: +886 2 3707 1098
Fax +886 2 2325 5844
Email: jacob@cht.com.tw
----- Original Message -----
From: "Pablo Morillas" <pa...@sortes.com>
To: <to...@jakarta.apache.org>
Sent: Wednesday, October 03, 2001 6:07 AM
Subject: Pool connection to database


> Hello all.
>
> I have a problem that I suppose is resolved by Tomcat. I'm using Tomcat
3.2
> and I can connect to an Oracle 8i database. The problem is that a process
is
> created by oracle in any connection to the database done from mines
> servlets. I want to use a pool of connection for limit the number of
> connection actives.
> Is there any way to specify a class that run when I start tomcat? If I
have
> any pool connection running inside tomcat I think that I will get the
pool,
> won't I?
>
> Thanks to all in advance.
>
> ==================================
> Pablo Morillas
> http://www.sortes.com
> pablo@sortes.com
> ==================================
>