tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <Chuck.Caldar...@unisys.com>
Subject RE: Connection Pooling questions
Date Wed, 01 Apr 2009 03:44:32 GMT
> From: allen.irwin@smartintegration.com.au
> [mailto:allen.irwin@smartintegration.com.au]
> Subject: RE: Connection Pooling questions
> 
>   <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"/>

You said maxActive was 30, but it's 50 in your config.  I've never used the Attunity drivers,
but the above looks ok as far as I can tell; perhaps someone else might see a problem.  You
might want to consider adding these:

  removeAbandoned="true"
  removeAbandonedTimeout="60"
  logAbandoned="true"

That will tell you if the pool thinks you're returning connections or not.  Change the timeout
setting (in seconds) to whatever you think is appropriate.

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

Correct; that's normally left up to the database.

> Here's the block I use:
> 		finally
> 		{
> 			// cleanup
> 			if (cs != null) cs.close();
> 			if (conn != null) conn.close();
> 		}
> Where cs = the statement.

If the cs.close() throws an exception, you won't close the connection.  Do you only ever have
one statement per connection?  And depending on the location of the finally block relative
to the rest of the code, you might not even go through there.

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

Regardless, it's good practice to clean up DB resources explicitly, preferably as soon as
you're done with them.

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

Depends on what you want; for a production environment, you never want the connections to
close.  They're cheap to keep around but expensive to create.

 - 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


Mime
View raw message