tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Ebeling <feb...@yahoo.de>
Subject Re: problems with dbcp
Date Mon, 03 Nov 2003 13:49:33 GMT
one cannot count on the finalizer to do this job. DB connections eat up 
resources (memory, client licenses), and you never know when they get 
reclaimed by the finalizer (if at all). So setting a timeout for each 
connection is definitly a good idea, I guess.

-Florian

Peter Guyatt wrote:

> Hi,
> 
> 	Why dont you override the finialize method so that when your objects fall
> out of scope and are garbage collected then you close the connections ?
> 
> Thanks
> 
> Pete
> 
> -----Original Message-----
> From: Florian Ebeling [mailto:febeli@yahoo.de]
> Sent: 03 November 2003 13:27
> To: Tomcat Users List
> Subject: Re: problems with dbcp
> 
> 
> Ok. That's the same point I am currently trying to solve. I
> intentionally leave connections open, but they don't get freed. Perhaps
> someone else could comment here?
> 
> -Florian
> 
> my settings in server.xml---------------
> 
> <Resource name="jdbc/TomcatDS"
>                 auth="Container"
>                 type="javax.sql.DataSource"/>
> 
>            <ResourceParams name="jdbc/TomcatDS">
>              <parameter>
>                <name>factory</name>
>                <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>              </parameter>
> 
>              <!-- Maximum number of dB connections in pool. Make sure you
>               configure your mysqld max_connections large enough to handle
>               all of your db connections. Set to 0 for no limit.
>               -->
>              <parameter>
>                <name>maxActive</name>
>                <value>20</value>
>              </parameter>
> 
>              <!-- Maximum number of idle dB connections to retain in pool.
>               Set to 0 for no limit.
>               -->
>              <parameter>
>                <name>maxIdle</name>
>                <value>5</value>
>              </parameter>
> 
>              <!-- Maximum time to wait for a dB connection to become
> available
>               in ms, in this example 10 seconds. An Exception is thrown if
>               this timeout is exceeded.  Set to -1 to wait indefinitely.
>               -->
>              <parameter>
>                <name>maxWait</name>
>                <value>10000</value>
>              </parameter>
> 
>              <parameter>
>               <name>username</name>
>               <value>caspar</value>
>              </parameter>
>              <parameter>
>               <name>password</name>
>               <value>geheim</value>
>              </parameter>
> 
>              <parameter>
>                 <name>driverClassName</name>
>                 <value>com.mysql.jdbc.Driver</value>
>              </parameter>
> 
>              <!-- The JDBC connection url for connecting to your MySQL dB.
>               The autoReconnect=true argument to the url makes sure that the
>               mm.mysql JDBC Driver will automatically reconnect if
> mysqld closed the
>               connection.  mysqld by default closes idle connections
> after 8 hours.
>               -->
>              <parameter>
>                <name>url</name>
> 
> <value>jdbc:mysql://localhost:3306/tomcatds?autoReconnect=true</value>
>              </parameter>
> 
>              <!-- Umgang mit nicht geschlossenen Statements, Connections und
>                   ResultSets.
>              -->
>              <parameter>
>                <name>removeAbandoned</name>
>                <value>true</value>
>              </parameter>
> 
>              <parameter>
>                <name>removeAbandonedTimeout</name>
>                <value>10</value>
>              </parameter>
> 
>              <parameter>
>                <name>logAbandoned</name>
>                <value>true</value>
>              </parameter>
> 
>              </ResourceParams>
> 
> Edson Alves Pereira wrote:
> 
> 
>>		But removeAbandoned and removeAbandonedTimeout doesn´t close
>>all ResultSet, Statement and Connections even if they are forsaken?
>>
>>
>>
>>
>>>----------
>>>De: 	Florian Ebeling[SMTP:febeli@yahoo.de]
>>>Responder: 	Tomcat Users List
>>>Enviada: 	segunda-feira, 3 de novembro de 2003 9:51
>>>Para: 	Tomcat Users List
>>>Assunto: 	Re: problems with dbcp
>>>
>>>Hi,
>>>
>>>you probably do nor close some statement, resultSet or connection. When
>>>using CP one has to do this always explicitly.
>>>
>>>Tyrex is an alternative CP implementation which has been replaced by DBCP.
>>>
>>>Edson Alves Pereira wrote:
>>>
>>>
>>>
>>>>	Hello folks, i followed what is written in tomcat-4.1.x´s JDNI
>>>>DataSource documentation, but i getting this error:
>>>>
>>>>java.sql.SQLException: DBCP could not obtain an idle db connection, pool
>>>>exhausted
>>>>
>>>>	The machanism is not returning my connection to pool, what do i
>>>>should do? Do i really need tirex as Persistence Layer?  Here is my DBCP
>>>>configuration:
>>>>
>>>><Resource name="jdbc/OracleDS"
>>>>auth="Container"
>>>>type="javax.sql.DataSource"/>
>>>><ResourceParams name="jdbc/OracleDS">
>>>><parameter>
>>>><name>factory</name>
>>>><value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>>>></parameter>
>>>>
>>>><parameter>
>>>><name>maxActive</name>
>>>><value>10</value>
>>>></parameter>
>>>>
>>>>
>>>><parameter>
>>>><name>maxIdle</name>
>>>><value>30</value>
>>>></parameter>
>>>>
>>>><parameter>
>>>><name>maxWait</name>
>>>><value>10000</value>
>>>></parameter>
>>>>
>>>><parameter>
>>>><name>username</name>
>>>><value>blah</value>
>>>></parameter>
>>>><parameter>
>>>><name>password</name>
>>>><value>blah</value>
>>>></parameter>
>>>>
>>>><parameter>
>>>><name>driverClassName</name>
>>>><value>oracle.jdbc.driver.OracleDriver</value>
>>>></parameter>
>>>>
>>>><parameter>
>>>><name>url</name>
>>>><value>jdbc:oracle:thin:@000.000.000:blah</value>
>>>></parameter>
>>>>
>>>><parameter>
>>>><name>validationQuery</name>
>>>><value>select sysdate from dual</value>
>>>></parameter>
>>>>
>>>><parameter>
>>>><name>removeAbandoned</name>
>>>><value>true</value>
>>>></parameter>
>>>>
>>>><parameter>
>>>><name>removeAbandonedTimeout</name>
>>>><value>60</value>
>>>></parameter>
>>>>
>>>><parameter>
>>>><name>logAbandoned</name>
>>>><value>true</value>
>>>></parameter>
>>>></ResourceParams>
>>>>
>>>>	As i wrote above, DBCP should revover all connection objects and
>>>>close automatic everything, but is not. Any idea?
>>>>
>>>>	Regards,
>>>>	Edson
>>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>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
> 


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