thanks a lot!, just one last question, what kind of troubles did u have with DBCP. coz this will be used in production so i want to know what to expect, however a refactoring is schedule anyway but not anytime sooner.
thanks once again!
David Friedman wrote:
Rajit,
I don't use the Struts DataSource because I had to much trouble with it a few months ago. However, the commons DBCP expains all parameters here: http://jakarta.apache.org/commons/dbcp/configuration.html
You should be able to set any of them in your struts-config.xml data-source entry with this syntax:
<set-property property="minIdle" value="XXX" />
I checked my testing and production environments and I forgot I've switched away from DBCP to C3P0 (it comes with Hibernate). However, I'd recommend the options (listed in the above mentioned web page):
validationQuery set to "select 1+1" works in MySQL and returns 1 row testWhileIdle set to "true" timeBetweenEvictionRunsMillis set to "1800000" (1000 miliseconds * 60 seconds * 30 minutes) testOnBorrow set to "true" minIdle set to "2" (or higher)
Regards, David
-----Original Message----- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 2:14 PM To: Struts Users Mailing List Subject: Re: org.apache.struts.legacy.GenericDataSource
hello david, thanks for the quick reply, could u pls mail me the extract of the <data-source which worked fr u. along all with the settings. (u can ofcourse remove the l/p :P ) this would be a great help! and have u have the kind of sucess with DBCP in dealing with connection pool and idle connections? thanks!
David Friedman wrote:
Rajat,
I've had that type of disconnect problem using Hibernate (a product
roughly
like Ibatis). My problem was one of the DBCP settings: minIdle. MySQL wasn't seeing any activity on some pool connections overnight, so it was disconnecting them. Lowering the minIdle setting seemed to cause DBCP to test each pool connection by performing a simple select automatically.
The
query seems to be a non-table select, along the lines of a 'select 1+1;'. That allowed MySQL to keep each connection active and not disconnect any overnight after being idle for hours.
Regards, David
-----Original Message----- From: Rajat Pandit [mailto:[EMAIL PROTECTED] Sent: Saturday, November 29, 2003 12:44 PM To: Struts Users Mailing List Subject: org.apache.struts.legacy.GenericDataSource
hello gurus, i have an terrible terrible problem with my application, after hosting this application it stops to work after 8-10hrs of idle state. then the server has to restart and then its fine again.
i learnt that the mysql driver disconects after 8hrs of an idle connection so i addred autoreconnect=true to the connection url. however the problem doesnt seem to get sovled. just extended fro another another and then the same problem again. i need to know how to remove org.apache.struts.legacy.GenericDataSource and use the connection from DBCP (commons lib ie.) and will i need to change the settings in the code (struts-config.xml) i also am thinking of refactoring the entire codebase usng iBatis. will it solve this issue?
pls help! i need this project to be up and running in the next week. thanks once again the logs follows.
NFO: Return allocated connection, activeCount=2, useCount=1 Nov 28, 2003 8:00:15 PM com.hedging.HedgeUser validUser INFO: --> Error: Communication link failure: java.io.IOException<-- Nov 28, 2003 8:00:15 PM org.apache.struts.legacy.GenericDataSource returnConnection INFO: releaseConnection(), activeCount=2, useCount=0 Nov 28, 2003 8:00:30 PM org.apache.jk.common.ChannelSocket
processConnection
INFO: connection timeout reached Nov 28, 2003 8:00:33 PM org.apache.jk.common.ChannelSocket
processConnection
INFO: connection timeout reached Nov 28, 2003 8:00:35 PM org.apache.jk.common.ChannelSocket
processConnection
INFO: connection timeout reached Nov 28, 2003 8:00:36 PM org.apache.jk.common.ChannelSocket
processConnection
INFO: connection timeout reached Nov 29, 2003 12:33:42 AM org.apache.jk.common.ChannelSocket processConnection INFO: connection timeout reached Nov 29, 2003 12:33:47 AM org.apache.jk.common.ChannelSocket processConnection INFO: connection timeout reached Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource getConnection INFO: getConnection() Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource getConnection INFO: Check for timeout, activeCount=2, useCount=0 Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource getConnection INFO: Found available connection Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource getConnection INFO: Return allocated connection, activeCount=2, useCount=1 Nov 29, 2003 12:33:58 AM com.hedging.HedgeUser validUser INFO: --> Error: No operations allowed after connection closed<-- Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource returnConnection INFO: releaseConnection(), activeCount=2, useCount=0 Nov 29, 2003 12:34:18 AM org.apache.jk.common.ChannelSocket processConnection --
Rajat Pandit | [EMAIL PROTECTED] +91 612 3117606 [ Developer and Part Time Human Being]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Rajat Pandit | [EMAIL PROTECTED] +91 612 3117606 [ Developer and Part Time Human Being]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Rajat Pandit | [EMAIL PROTECTED] +91 612 3117606 [ Developer and Part Time Human Being]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

