Hi Robert,
when you said "I have both parameters in my pool definition and they work
fine. "
How did you define the pool , is it by using BasicDataSourceFactory or
somthing else...
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
I reason i am asking is i still don't understand how pooling is achieved...
BasicDataSourcefactory creates BasicDatasource and when you use the below
code the datasource obtained is basicdatasource.
Context ctx = new InitialContext();
String dataSrc =
msgResource.getMessage(OEMAPIConstants.DATA_SOURCE_NAME);
Context env = (Context)ctx.lookup("java:comp/env");
dataSource = (DataSource) env.lookup(dataSrc);
Connection con = dataSource.getConnection();
Datasource.getConnection gives java.sql.Connection object..so i am not sure
how the Connection is a poolable connection...
riginal Message-----
From: Robert Bateman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 3:59 PM
To: Tomcat Users List
Subject: Re: removeAbandoned in DBCP
On Wednesday 22 September 2004 03:28 pm, Shilpa Nalgonda wrote:
> Hi,
> My connection pool works if i set the removeAbandon parameter to true, but
> i still do not understand why it works that way,
> can someone suggest...can i use that parameter...
>
> <parameter>
> <name>removeAbandoned</name>
> <value>true</value>
> </parameter>
> <parameter>
> <name>removeAbandonedTimeout</name>
> <value>0</value>
> </parameter>
>
I have both parameters in my pool definition and they work fine. I did set
my
Timeout a bit bigger though. In my prod. TC app, I have set (for MySQL,
ymmv):
<!-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit. -->
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<!-- Maximum time to wait for a dB connection to become available
in ms, in this example 15 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely. -->
<parameter>
<name>maxWait</name>
<value>15000</value>
</parameter>
<!-- Validation Query to insure our connection is still valid. -->
<parameter>
<name>validationQuery</name>
<value>SELECT version()</value>
</parameter>
<!-- Make sure we test each and every connection before we borrow
it to see if it is still valid. -->
<parameter>
<name>testOnBorrow</name>
<value>true</value>
</parameter>
<!-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit. -->
<parameter>
<name>maxIdle</name>
<value>100</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<!--Use the removeAbandonedTimeout parameter / seconds.-->
<parameter>
<name>removeAbandonedTimeout</name>
<value>60</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
Also, I noticed on my last app that I was forgetting to release the pooled
connection and I eventually ran out of entries. You might want to double
check you are releasing/closing your connection.
Bob
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]