tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: Connection Pool Exhausted
Date Sat, 15 Aug 2009 01:57:39 GMT

dbcp parameters are located in a *.jocl file located on your classpath 
(WEB-INF/classes)
which should look something like
<object class="org.apache.commons.dbcp.PoolableConnectionFactory" xmlns="http://apache.org/xml/xmlns/jakarta/commons/jocl">
   <!-- the first argument is the ConnectionFactory -->
   <object class="org.apache.commons.dbcp.DriverManagerConnectionFactory">
      <string value="jdbc:some:connect:string"/>
      <object class="java.util.Properties" null="true"/>
   </object>
   <!-- the next argument is the ObjectPool -->
   <object class="org.apache.commons.pool.impl.GenericObjectPool">
      <object class="org.apache.commons.pool.PoolableObjectFactory" null="true"/>
      <int value="10"/> <!-- max active -->
      <byte value="1"/> <!-- when exhausted action, 0 = fail, 1 = block, 2 = grow
-->
      <long value="2000"/> <!-- max wait -->
      <int value="10"/> <!-- max idle -->
      <boolean value="false"/> <!-- test on borrow -->
      <boolean value="false"/> <!-- test on return -->
      <long value="10000"/> <!-- time between eviction runs -->
      <int value="5"/> <!-- number of connections to test per eviction run -->
      <long value="5000"/> <!-- min evictable idle time -->
      <boolean value="true"/> <!-- test while idle -->
   </object>
   <!-- the next argument is the KeyedObjectPoolFactory -->
   <object class="org.apache.commons.pool.impl.StackKeyedObjectPoolFactory">
      <int value="5"/> <!-- max idle -->
   </object>
   <string value="SELECT COUNT(*) FROM DUAL"/> <!-- validation query -->
   <boolean value="false"/> <!-- default read only -->
   <boolean value="true"/> <!-- default auto commit -->
</object>herr shroeder suggests is change int value from 10 to 1 like this

      <int value="10"/> <!-- max active -->
to 
     <int value="1"/> <!-- max active -->

Test_Harness (assuming the file you saved is in WEB-INF/classes/poolingDriverExample.jocl
//  java -Djdbc.drivers= com.mysql.jdbc.Driver:org.apache.commons.dbcp.PoolingDriver \
//       -classpath commons-pool-1.3.jar:commons-dbcp-1.2.2.jar:oracle-jdbc.jar:jaxp.jar:parser.jar:sax2.jar:.
\
//       JOCLPoolingDriverExample
//       "jdbc:apache:commons:dbcp:/poolingDriverExample"
//       "SELECT * FROM DUAL"

the above test harness only works for jdbc MySQL driver
you will have to sub in your DAO MySQL driver ..here is a DAO wrapper on MySQL jdbc driver
https://wikihub.berkeley.edu/display/istas/Class+10+-+June+4+-+DAO,+Connection+Pool
read this
http://commons.apache.org/dbcp/apidocs/org/apache/commons/dbcp/package-summary.html

Viel Gluck/Buena Suerte
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.






> Date: Fri, 14 Aug 2009 18:04:33 -0700
> From: kwalker@sbceo.org
> To: users@tomcat.apache.org
> Subject: Re: Connection Pool Exhausted
> 
> Sorry if this is a stupid question, I am pretty new to this, but how do I set
> the db connection pool size to 1?
> 
> Thanks,
> Kristen
> 
> Quoting Hassan Schroeder <hassan.schroeder@gmail.com>:
> >
> > On your test/staging server, set your db connection pool size to 1
> > and exercise the site; if there's a connection leak, you'll find it pretty
> > fast. :-)
> >
> > --
> > Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
> > twitter: @hassan
> >
> >
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Get free photo software from Windows Live
http://www.windowslive.com/online/photos?ocid=PID23393::T:WLMTAGL:ON:WL:en-US:SI_PH_software:082009
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message