You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2003/10/01 11:05:31 UTC

Re: Datasource connections not released when reloading context

Hi Matt,
you don't destroy them, you just close them.

if (!conn.isClosed()) conn.close();





On 09/30/2003 12:51 AM Matt Raible wrote:
> If I'm getting my database connections from a JNDI resource (configured in
> server.xml) how do I destroy these suckers.  Sample code would be great - or
> tell me to RTFM.
> 
> Matt
> 
> -----Original Message-----
> From: Phillip Qin [mailto:Phillip.Qin@shareowner.com]
> Sent: Monday, September 29, 2003 8:04 AM
> To: 'Tomcat Users List'
> Subject: RE: Datasource connections not released when reloading context 
> 
> 
> - to release your DB connections when your app is shutdown or reloaded:
> implement destroy method in your servlet class to close them.
> - to prevent connections getting exhausted, use evictor if your use commons
> pooling and dbcp.
> 
> -----Original Message-----
> From: Jose Alfonso Martinez [mailto:trilock@linuxcenter.com.mx] 
> Sent: September 27, 2003 7:31 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Datasource connections not released when reloading context 
> 
> Hi guys,
> 
> Does any one know if there is a possibility of tomcat, for any reason, to
> reload a context without telling it to do so????
> 
> I am having a problem that after 2 or 3 days without reloading tomcat,
> pooled-connections from the datasource get exahusted.
> 
> The only case I have seen that the number of pooled-connections is
> incremented is when I reloaded my context. In this case, the reloaded
> context's datasource opened a new set of connections to work on (leaving the
> older connections opened and not releasing them until tomcat is shutdown).
> If the context gets reloaded over and over again, eventually connections
> with the DBMS will get exahusted...
> 
> Is that the expected behavior???? To leave conections open when reloading a
> context????
> 
> Would there be another posibility for pooled-connections to get exahusted,
> once they were set up and correctly running???
> 
> Thanks in advance
> 
> Jose
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


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


Re: Datasource connections not released when reloading context

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
actually that doesn't really close them, since it's a connection pool, 
but it tells the connection pool that they're free for someone else.

On 10/01/2003 11:05 AM Adam Hardy wrote:
> Hi Matt,
> you don't destroy them, you just close them.
> 
> if (!conn.isClosed()) conn.close();
> 
> 
> 
> 
> 
> On 09/30/2003 12:51 AM Matt Raible wrote:
> 
>> If I'm getting my database connections from a JNDI resource 
>> (configured in
>> server.xml) how do I destroy these suckers.  Sample code would be 
>> great - or
>> tell me to RTFM.
>>
>> Matt
>>
>> -----Original Message-----
>> From: Phillip Qin [mailto:Phillip.Qin@shareowner.com]
>> Sent: Monday, September 29, 2003 8:04 AM
>> To: 'Tomcat Users List'
>> Subject: RE: Datasource connections not released when reloading context
>>
>> - to release your DB connections when your app is shutdown or reloaded:
>> implement destroy method in your servlet class to close them.
>> - to prevent connections getting exhausted, use evictor if your use 
>> commons
>> pooling and dbcp.
>>
>> -----Original Message-----
>> From: Jose Alfonso Martinez [mailto:trilock@linuxcenter.com.mx] Sent: 
>> September 27, 2003 7:31 PM
>> To: tomcat-user@jakarta.apache.org
>> Subject: Datasource connections not released when reloading context
>> Hi guys,
>>
>> Does any one know if there is a possibility of tomcat, for any reason, to
>> reload a context without telling it to do so????
>>
>> I am having a problem that after 2 or 3 days without reloading tomcat,
>> pooled-connections from the datasource get exahusted.
>>
>> The only case I have seen that the number of pooled-connections is
>> incremented is when I reloaded my context. In this case, the reloaded
>> context's datasource opened a new set of connections to work on 
>> (leaving the
>> older connections opened and not releasing them until tomcat is 
>> shutdown).
>> If the context gets reloaded over and over again, eventually connections
>> with the DBMS will get exahusted...
>>
>> Is that the expected behavior???? To leave conections open when 
>> reloading a
>> context????
>>
>> Would there be another posibility for pooled-connections to get 
>> exahusted,
>> once they were set up and correctly running???
>>
>> Thanks in advance
>>
>> Jose
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
> 

-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


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