Timer

641 views
Skip to first unread message

Juan José 'Peco' San Martín

unread,
May 7, 2014, 3:44:56 PM5/7/14
to multisoft...@googlegroups.com
Hello all.

My application works with Mysql.
I found an issue when the user let the application in stand-by (nothing is  touched during several minutes).
Mysql session is lost, so that when the user returns, the application can not connect to the database.
I have tested several solutions without success (at server side).

Now my idea is to include a Timer into the application to keep the database connection live.

Has anyone developed something similar?

I found KeyTime() in the documentation but I'm not sure if it's possible to do the trick.

Thank you for any recommendation!
Peco

Paul

unread,
Jan 23, 2019, 5:16:46 AM1/23/19
to multisoft...@googlegroups.com
Hello Peco,

most SQL servers have configurable time-out. In your application, you may check whether the connection is still alive by triggering some UDF via TriggerUdf() from the FS2 Toolbox, e.g.
   ok := TriggerUdf( {|| CheckSql()}, 60 )
where the FUNCTION CheckSql() is executed every 60 seconds. The function should then check whether a SQL database is open and the connection still active, and if so, perform some SQL request (like the current record count of the table etc). Such a request will/should reset the time-out counter of the SQL server.

Hope this helps you,
Paul
Reply all
Reply to author
Forward
0 new messages