You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by freeway <fw...@qad.com> on 2010/05/11 06:28:30 UTC

How to keep alive idle JDBC connections?

Does OpenEJB support an option to keep alive idle JDBC data source
connections in a JTA-managed connection pool?  I have not found such an
option yet, but it seems like a common need.  For example, the MySQL server
uses a configuration setting 'wait_timeout', defaulting to 8 hours, that
times out idle connections with no indefinite wait option.  How can OpenEJB
force such connections to stay open?

-- 
View this message in context: http://openejb.979440.n4.nabble.com/How-to-keep-alive-idle-JDBC-connections-tp2173301p2173301.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: How to keep alive idle JDBC connections?

Posted by freeway <fw...@qad.com>.
Thank you both for the advice.  I see now that there are a handful of DBCP
options accessible from OpenEJB that can be used in combination to nurse
open connections: ValidationQuery, TestOnBorrow, TestOnReturn,
TestWhileIdle, TimeBetweenEvictionRunsMillis, NumTestsPerEvictionRun,
MinEvictableIdleTimeMillis, MinIdle.

I guess I missed them the first time around because I was looking explicitly
for a 'keep-alive' kind of implementation, whereas the DBCP approach is to
test connections at configurable points and replace stale ones with new
ones.  This should work fine.

-- 
View this message in context: http://openejb.979440.n4.nabble.com/How-to-keep-alive-idle-JDBC-connections-tp2173301p2174274.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: How to keep alive idle JDBC connections?

Posted by Jean-Louis MONTEIRO <je...@atosorigin.com>.
Hi,

you can definitely do that using the connection pool.
Internally, OpenEJB relies on Apache Commons DBCP to manage connection
pools.

Have a look at those pages, you will find some useful information.
http://openejb.apache.org/3.0/configuring-datasources.html
http://openejb.apache.org/3.0/configuring-datasources.html 
http://commons.apache.org/dbcp/configuration.html
http://commons.apache.org/dbcp/configuration.html 

Hope it helps.
Jean-Louis
-- 
View this message in context: http://openejb.979440.n4.nabble.com/How-to-keep-alive-idle-JDBC-connections-tp2173301p2173814.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

RE: How to keep alive idle JDBC connections?

Posted by Cristian Botiza <Cr...@endava.com>.
Can't this be configured in the connection pool? Normally you'd use a connection pool RA in the application server and instruct the EJBs to use that in openejb-jar.xml. Maybe the connection pool specification allows some parameters for idle connection management?

________________________________________
From: freeway [fwy@qad.com]
Sent: 11 May 2010 07:28
To: users@openejb.apache.org
Subject: How to keep alive idle JDBC connections?

Does OpenEJB support an option to keep alive idle JDBC data source
connections in a JTA-managed connection pool?  I have not found such an
option yet, but it seems like a common need.  For example, the MySQL server
uses a configuration setting 'wait_timeout', defaulting to 8 hours, that
times out idle connections with no indefinite wait option.  How can OpenEJB
force such connections to stay open?

--
View this message in context: http://openejb.979440.n4.nabble.com/How-to-keep-alive-idle-JDBC-connections-tp2173301p2173301.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the EndavaIT Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.

Endava Limited is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava Limited is the Endava group holding company and does not provide any services to clients. Each of Endava Limited and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. Please refer to the “Legal” section on our website for a list of legal entities.