tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kwok Peng Tuck <pengt...@makmal.net>
Subject Re: DB Connection
Date Mon, 26 May 2003 23:58:47 GMT
Closing the statements and result sets returns them to the pool for 
reuse, instead of them being gone forever.
The code block looks something like this :
try {

}catch  {

}finally {
       //close here.
}
Generally the idea is to use connections already available and not make 
any new ones every time a servlet or jsp is called. So if your pool size 
is  min 5 and max 10 then the most connections ever used will be 10 and 
should not exceed that value.


Jan Behrens wrote:

>Thanks to you both,
>
>sorry about my misleading post. I understand that, in using a connection pool
>i can get Tomcat to handle the number of connections at any given time. Is
>that correct? If I still have to ensure that all ResultSet's and connections
>have to be closed, then where is the advantage? And, would it be a good idea
>to automatically close abandoned connections after a certain amount of time?
>
>Regards Jan
>
>  
>
>>-----Original Message-----
>>From: Dave Mock [mailto:dave_mock2003@yahoo.com]
>>Sent: Monday, May 26, 2003 11:14 PM
>>To: Tomcat Users List
>>Subject: Re: DB Connection
>>
>>
>>b carefull when using DBCP
>>always remember to close the
>>ResultSet/Statement/PreparedStatement and last but not
>>least - the Connection object
>>
>>
>>
>>    
>>
>>>> The funny thing is this:
>>>>it works quite well for some time, but as soon as
>>>>        
>>>>
>>>load on the app increases
>>>      
>>>
>>>>the error appears. I therefore thought it must be
>>>>        
>>>>
>>>related to the number of
>>>      
>>>
>>>>open transactions but I am not sure.
>>>>        
>>>>
>>- edited -
>>
>>    
>>
>>>I''d say your custom code isn't handling the DB
>>>connections too well, look
>>>into setting up a JNDI datasource and use DBCP,
>>>there is some documentation
>>>on this at:
>>>
>>>
>>>      
>>>
>>http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-exam
>>ples-howto.html
>>
>>
>>__________________________________
>>Do you Yahoo!?
>>The New Yahoo! Search - Faster. Easier. Bingo.
>>http://search.yahoo.com
>>
>>---------------------------------------------------------------------
>>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
>
>
>
>  
>


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


Mime
View raw message