Hahahaha… Yes, that's most definitely better :D. I don't actually use MySQL so I had no idea that existed.
- hugi On 22.7.2013, at 13:28, Kieran Kelleher <kelleh...@gmail.com> wrote: > Hugi ... that's overkill! Just add autoReconnect=true to the connection URL. > :P ....... for example: > > mydatabase.URL=jdbc:mysql://myhost/mydatabase?capitalizeTypenames=true&useBundledJdbcInfo=true&autoReconnect=true > > On Jul 20, 2013, at 4:26 AM, Hugi Thordarson <h...@karlmenn.is> wrote: > >> Below is an example of how you might do this with a Timer. >> >> You *could* copy this class to all of your apps, call init() in their >> Application class constructors and call it a day (or, as you suggest, >> subclass ERXApplication and use that subclass in your MySQL apps). But best >> practice would really be to have a principal class in your common framework >> (a class that's loaded when the framework is loaded, you can specify it in >> the "WOLips Development"-part of your Eclipse project's properties). And >> that principal class should probably make sure you're listening for >> EOModelGroup.ModelAddedNotification to see which models use MySQL and then >> use that information to create keepalive-timers for each MySQL connection. >> >> The way you go depends on the scale of your operation, I guess. But a little >> overengineering never hurt anyone. *cough cough* >> >> ----------------- >> >> public class MakeMySQLSuckALittleLess { >> >> public static void init() { >> NSTimestamp firstRun = new >> NSTimestamp().timestampByAddingGregorianUnits( 0, 0, 0, 1, 0, 0 ); >> new Timer().scheduleAtFixedRate( new >> KeepMySQLConnectionAliveTask(), firstRun, 3600 * 1000 ); >> } >> >> private static class KeepMySQLConnectionAliveTask extends TimerTask { >> >> @Override >> public void run() { >> EOFetchSpecification fs = …; // Perform some >> lightweight operation on your MySQL connection >> >> ERXEC.newEditingContext().objectsWithFetchSpecification( fs ); >> } >> } >> } >> >> ----------------- >> >> - hugi >> >> >> >> On 20.7.2013, at 06:49, Pierre Gilquin <pgilq...@citycable.ch> wrote: >> >>> Yes better than restart mysqld or the server ... >>> >>> Could you please share some lines of code ?. >>> In order to do that for all mysql apps, I think to subclass ERXApplication >>> and use a independent access like "show tables" >>> >>> >>> Pierre >>> >>> >>>> That's what I do... >>>>> On Jul 19, 2013, at 4:50 PM, Hugi Thordarson <h...@karlmenn.is> wrote: >>>>> >>>>> Create a Timer that fires every hour to fetch an object? >>>>> >>>>> It's the perfect hack; simple yet disgusting. >>>>> >>>>> - hugi >>>>> >>>>> >>>>>> On 19.7.2013, at 15:01, Pierre Gilquin <pgilq...@citycable.ch> wrote: >>>>>> >>>>>> Thanks for your help >>>>>> >>>>>> >>>>>> I realize that 8 hours are the setting for wait_timeout in mysql server. >>>>>> >>>>>> As my app is not used at night, I think to change wait_timeout to 24h >>>>>> and schedule a restart of my WO app every night. >>>>>> >>>>>> >>>>>> Do you thing it could solve the problem in a easy way ? >>>>>> >>>>>> >>>>>> Pierre >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> Hi, >>>>>>> This is a well known bug in MySQL driver. It happens after 8 hours of >>>>>>> being idle. Try not to use the driver 's default connection pool, use >>>>>>> some altetnatives such as C3po. >>>>>>> Best of luck! >>>>>>> On 19 Jul 2013 20:33, "Pierre Gilquin" <pgilq...@citycable.ch >>>>>>> <mailto:pgilq...@citycable.ch>> wrote: >>>>>>> Hi >>>>>>> If mysql is not accessed by my app for a long period of time (around >>>>>>> 8h), an exception is throwned. >>>>>>> Is there a setting that I can apply to my wonder-WO app or mysql to >>>>>>> prevent this ? >>>>>>> Thanks in advance >>>>>>> Pierre >>>>>> _______________________________________________ >>>>>> Do not post admin requests to the list. They will be ignored. >>>>>> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) >>>>>> Help/Unsubscribe/Update your Subscription: >>>>>> https://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is >>>>>> >>>>>> This email sent to h...@karlmenn.is >>>>> >>>>> _______________________________________________ >>>>> Do not post admin requests to the list. They will be ignored. >>>>> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) >>>>> Help/Unsubscribe/Update your Subscription: >>>>> https://lists.apple.com/mailman/options/webobjects-dev/kenlists%40anderhome.com >>>>> >>>>> This email sent to kenli...@anderhome.com >>> >>> _______________________________________________ >>> Do not post admin requests to the list. They will be ignored. >>> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) >>> Help/Unsubscribe/Update your Subscription: >>> https://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is >>> >>> This email sent to h...@karlmenn.is >> >> _______________________________________________ >> Do not post admin requests to the list. They will be ignored. >> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com >> >> This email sent to kelleh...@gmail.com > > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is > > This email sent to h...@karlmenn.is
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com