RE: removeAbandoned in DBCP

2004-09-22 Thread Shilpa Nalgonda
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
  nameremoveAbandoned/name
  valuetrue/value
/parameter
parameter
nameremoveAbandonedTimeout/name
value0/value
/parameter


-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 11:13 AM
To: Tomcat Users List
Subject: RE: Tomcat 4.1 Connection Pooling...



Hi,
My configurations tend to be very similar to those in the documentation.
Check the DBCP (http://jakarta.apache.org/common/dbcp) site for what the
parameters like maxIdle mean.

My code to look up a DataSource and get a connection is the same as
yours, and the same as the docs.  It's boilerplate: Create an
InitialContext, lookup java:comp/env/whatever your resource name is,
cast it to DataSource, getConnection.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Shilpa Nalgonda [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 11:05 AM
To: Tomcat Users List
Subject: RE: Tomcat 4.1 Connection Pooling...

Thanks.
Maybe its the parameter configuration can you send me your
configuration
for
connection pooling...
I am using these parameters...
maxActive :20
maxIdle :10
maxWait :1
removeAbandoned :true  -- what exactly is MaxIdle  parameter..

Also my application makes 7 database queries, each query gets
connection
from datasource and closes() the connection in finally block.  When it
gets
connection from datasource it is supposed to get it from pool right???

I noticed that after my application runs 3 times --(3x7 =21).. it gives
me
this error

org.apache.commons.dbcp.SQLNestedException: Cannot get a connection,
pool
exhausted, cause:
java.util.NoSuchElementException: Timeout waiting for idle object
at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericOb..

So can you send me ur config and code snippet to get datasource if
possible...


-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 10:55 AM
To: Tomcat Users List
Subject: RE: Tomcat 4.1 Connection Pooling...



Hi,
Nope, I can't help unfortunately.  I used Tomcat 4.1 for years
connecting to Oracle 8i and 9i, and I continue to do so now with Tomcat
5.0 and 5.5.  Maybe I'm just lucky, but the docs (specifically the JDBC
DataSources how-to) have always worked for me out of the box.  I've
never seen the error you describe.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Shilpa Nalgonda [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 10:44 AM
To: Tomcat Users List
Subject: RE: Tomcat 4.1 Connection Pooling...

Hi Yoav Shapira,
Can you put some light on this pooling stuff...
Thanks.
Shilpa.

-Original Message-
From: Shilpa Nalgonda [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 9:31 AM
To: Tomcat Users List
Subject: RE: Tomcat 4.1 Connection Pooling...


Hi Cary,
I am running my application on both windowsxp and Linux. And my Oracle
version is 8i.
I have the same problem on both OS.  I think increasing the number of
processes would not help.
This has got something to do with Tomcat connection pooling
configuration.
I am missing some configuration stuff there...
if i use these below parameters in server.xml iget timeout
exception...just
after couple of requests..
maxActive :20
maxIdle :10
mxWait :1
removeAbandoned :true
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection,
pool
exhausted, cause:
java.util.NoSuchElementException: Timeout waiting for idle object 

And if i use this below configuration i get ORA:00020 exception...
maxActive :0
maxIdle :0
mxWait :0
removeAbandoned :true

Can you please help---i have been looking into this since 2 days and
still
it doesn't work...

-Original Message-
From: Cary Conover [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 21, 2004 10:09 PM
To: Tomcat Users List
Subject: RE: Tomcat 4.1 Connection Pooling...


Shilpa,

What OS are you running this configuration on?  If it is AIX I would
investigate to see how the system is configured for the number of
processes
per user on the system.  If it is configured as a Workstation it is
defaulted to 128 processes / login.  If it is configured as a server
it
is
set to 500 processes / login.  Plus Oracle support site suggests in
the
neighborhood of 2500 processes / login for Oracle 9i to function well
if
you
are running 9i.  These are all system settings that can be found in
smitty
on the system and adjusted as root user.

Hope this helps,

Cary

Shilpa Nalgonda [EMAIL PROTECTED] wrote:
Can someone please suggest how to achieve connection Pooling in tomcat
4.1.
As per the docs i have
1) configured server.xml to include the resource parameters (
datasource,
connection pool size etc)
2) In application code , retrieve 

Re: removeAbandoned in DBCP

2004-09-22 Thread Robert Bateman
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
   nameremoveAbandoned/name
   valuetrue/value
 /parameter
 parameter
 nameremoveAbandonedTimeout/name
 value0/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
namemaxActive/name
value100/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
namemaxWait/name
value15000/value
/parameter
!-- Validation Query to insure our connection is still valid. --
parameter
namevalidationQuery/name
valueSELECT version()/value
/parameter
!-- Make sure we test each and every connection before we borrow
 it to see if it is still valid. --
parameter
nametestOnBorrow/name
valuetrue/value
/parameter
!-- Maximum number of idle dB connections to retain in pool.
 Set to 0 for no limit. --
parameter
namemaxIdle/name
value100/value
/parameter
parameter
nameremoveAbandoned/name
valuetrue/value
/parameter
!--Use the removeAbandonedTimeout parameter / seconds.--
parameter
nameremoveAbandonedTimeout/name
value60/value
/parameter
parameter
namelogAbandoned/name
valuetrue/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]



RE: removeAbandoned in DBCP

2004-09-22 Thread Shilpa Nalgonda
Thanks a lot for the reply.  I am releasing all the connections and other
resources in my entire application.
I am using Tomcat4.1.30 and Oracle 8i..
But i have one question though,
does
Connection con = dataSource.getConnection();
 ensures that we are creating connection pool and getting connection from
the pool?
i noticed that there are several classes in DBCp like Pooled Connection
etc., can we use those ...

-Original 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
   nameremoveAbandoned/name
   valuetrue/value
 /parameter
 parameter
 nameremoveAbandonedTimeout/name
 value0/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
namemaxActive/name
value100/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
namemaxWait/name
value15000/value
/parameter
!-- Validation Query to insure our connection is still valid. --
parameter
namevalidationQuery/name
valueSELECT version()/value
/parameter
!-- Make sure we test each and every connection before we borrow
 it to see if it is still valid. --
parameter
nametestOnBorrow/name
valuetrue/value
/parameter
!-- Maximum number of idle dB connections to retain in pool.
 Set to 0 for no limit. --
parameter
namemaxIdle/name
value100/value
/parameter
parameter
nameremoveAbandoned/name
valuetrue/value
/parameter
!--Use the removeAbandonedTimeout parameter / seconds.--
parameter
nameremoveAbandonedTimeout/name
value60/value
/parameter
parameter
namelogAbandoned/name
valuetrue/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]



RE: removeAbandoned in DBCP

2004-09-22 Thread Shilpa Nalgonda
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
  namefactory/name
  valueorg.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
   nameremoveAbandoned/name
   valuetrue/value
 /parameter
 parameter
 nameremoveAbandonedTimeout/name
 value0/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
namemaxActive/name
value100/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
namemaxWait/name
value15000/value
/parameter
!-- Validation Query to insure our connection is still valid. --
parameter
namevalidationQuery/name
valueSELECT version()/value
/parameter
!-- Make sure we test each and every connection before we borrow
 it to see if it is still valid. --
parameter
nametestOnBorrow/name
valuetrue/value
/parameter
!-- Maximum number of idle dB connections to retain in pool.
 Set to 0 for no limit. --
parameter
namemaxIdle/name
value100/value
/parameter
parameter
nameremoveAbandoned/name
valuetrue/value
/parameter
!--Use the removeAbandonedTimeout parameter / seconds.--
parameter
nameremoveAbandonedTimeout/name
value60/value
/parameter
parameter
namelogAbandoned/name
valuetrue/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]