Pretty sure it's a rogue connection that stays open. 

-----Original Message-----
From: Shaun Farrugia [mailto:[email protected]] 
Sent: Wednesday, April 01, 2009 9:13 AM
To: Tomcat Users List; [email protected]; 
[email protected]
Subject: RE: Connection Pooling questions

Hey Chuck,

What happens when the statement isn't closed but the connection is returned to 
the pool?  I have some code blocks that don't have a finally block to close the 
result set and prepared statement.  If an exception happens the statement and 
the result set stay open but the connection gets returned to the pool.

What is the effect of this ?   

-----Original Message-----
From: [email protected] 
[mailto:[email protected]]
Sent: Tuesday, March 31, 2009 11:58 PM
To: [email protected]; [email protected]
Subject: RE: Connection Pooling questions


Sorry, I included an older context.xml than the one I've been testing with.
That one has 30 for maxActive (everything else is the same).

Thank you very much for your replies Chuck, I think you gave me plenty to
think about and play with to resolve my problem.  Thanks again!



Original Message:
-----------------
From: Caldarale, Charles R [email protected]
Date: Tue, 31 Mar 2009 22:44:32 -0500
To: [email protected]
Subject: RE: Connection Pooling questions


> From: [email protected]
> [mailto:[email protected]]
> 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: [email protected]
For additional commands, e-mail: [email protected]



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



---------------------------------------------------------------------
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to