tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "allen.irwin@smartintegration.com.au" <allen.ir...@smartintegration.com.au>
Subject RE: Connection Pooling questions
Date Wed, 01 Apr 2009 03:15:06 GMT

Thank you very much for your reply.  my response to your responses follow:

> Post your entire context.xml so we can see the rest of the <Resource>
element.  Your 
> settings may conflict with what the database expects, resulting in
orphaned connections.

Here it is:

<Context>
  <Resource name="jdbc/AttunitySProcDS" auth="Container"
            type="javax.sql.DataSource"
            driverClassName="com.attunity.jdbc.NvDriver"
url="jdbc:attconnect://10.20.5.107:7777/baynav;DefTdpName=webdemo"
            maxActive="50" maxIdle="10"/>
</Context>


>> Also, the default behavior seems to be that the connections 
>> never close within the pool when they are not being used.

> That is the whole point of having a pool.

so you're saying that the pool will never close any of the connections due
to them not being used?


> The evidence suggests otherwise.  You also need to close result sets and
statements 
> associated with the connection, and all of the close() calls should be in
a finally 
> block to insure they always get executed.

Here's the block I use:

		finally
		{
			// cleanup
			if (cs != null) cs.close();
			if (conn != null) conn.close();
		}

Where cs = the statement.  I don't close the result set as closing the
statement is supposed to do that.


> That usually depends entirely on how your DB is configured; if it has a
high timeout 
> value (most do), the connections will persist for a long time.  You can
configure a 
> timeout value for the pool to evict idle connections, but that's disabled
by default.

Maybe this timeout value is what I'm looking for?


Original Message:
-----------------
From: Caldarale, Charles R Chuck.Caldarale@unisys.com
Date: Tue, 31 Mar 2009 21:57:01 -0500
To: users@tomcat.apache.org
Subject: RE: Connection Pooling questions


> From: allen.irwin@smartintegration.com.au
> [mailto:allen.irwin@smartintegration.com.au]
> Subject: Connection Pooling questions
> 
> I configure it using the suggested /META-INF/context.xml with:
> maxActive="30" maxIdle="10"

Post your entire context.xml so we can see the rest of the <Resource>
element.  Your settings may conflict with what the database expects,
resulting in orphaned connections.

> I assumed that maxActive would limit the total amount of DB
> connections that could ever be open at one time (in this case 30).

That limits the number the pool is managing.  If the pool considers some of
them to be abandoned or in error, the number the DB knows about may be
higher.

> Yet from what I see it seems like I am limited to maxActive + maxIdle
> connections open (in this case 40).  Is that true?

Don't think so.

> Also, the default behavior seems to be that the connections 
> never close within the pool when they are not being used.

That is the whole point of having a pool.

> I do close the connections within my program using conn.close();

The evidence suggests otherwise.  You also need to close result sets and
statements associated with the connection, and all of the close() calls
should be in a finally block to insure they always get executed.

> I thought that when the connections were not used that they 
> would over time be "really" closed and I would end up with 
> the maxIdle value of 10 open connections within my Pool.

That usually depends entirely on how your DB is configured; if it has a
high timeout value (most do), the connections will persist for a long time.
You can configure a timeout value for the pool to evict idle connections,
but that's disabled by default.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail and
its attachments from all computers.


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



--------------------------------------------------------------------
mail2web.com – What can On Demand Business Solutions do for you?
http://link.mail2web.com/Business/SharePoint



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


Mime
View raw message