[SOLVED] TMySQL50Connection and timeout lazarus / 16-Databases ---------------------------------------------------------------------- Dibo · 2010-05-24 14:19 Hi, I'm using TMySQL50Connection. When I don't send any queries for about one minute, every next query fails with errors: MySQL server has gone away. KeepConnection doesn't work (if it does what I think). I know this is server configuration, but how can I keep connection on client side? I can do some kind of timer and send simple query but maybe is any switch? Regards ---------------------------------------------------------------------- Lacak2 · 2010-05-24 23:16 KeepConnection property is not used at all, so changing it has no effect. AFAIK there is no "automatic disconnect" feature, so I think, that source of your error message is in another place. There is api function mysql_options with param MYSQL_OPT_RECONNECT ... http://dev.mysql.com/doc/refman/5.1/en/mysql-options.html ---------------------------------------------------------------------- Dibo · 2010-05-25 05:08 Thanks for the tip. I found this function in mysql.inc Code: [Select]function mysql_options(mysql:PMYSQL; option:mysql_option; arg:Pchar):cint;extdecl;external mysqllib name 'mysql_options';But I don't know how to get a PMYSQL from TMySQL50Connection. It is in private section and there is no public property :/ ---------------------------------------------------------------------- Loesje · 2010-05-25 14:54 The TMySQLConnection.Handle actually returns the PMYSQL you are looking for. But it's better to add this option to TMysqlConnection, so that you can set it using TMysqConnection.Params. Can you create a bug report for that? ---------------------------------------------------------------------- Dibo · 2010-05-26 11:19 Thanks, now it works . Sample: Code: [Select]uses mysql50 procedure TForm1.Button1Click(Sender: TObject); begin   MySQL50Connection1.Connected := True;   mysql_options(MySQL50Connection1.Handle, MYSQL_OPT_RECONNECT, 'true'); end; QuoteCan you create a bug report for thatYes, I can. Thanks for help. Must I lock this topic or just add [Solved] to subject? ---------------------------------------------------------------------- Lacak2 · 2010-05-27 22:28 You must fill bug report here: http://bugs.freepascal.org/my_view_page.php ---------------------------------------------------------------------- eara · 2014-04-17 07:01 thanks LaCak again.... ---------------------------------------------------------------------- tsr · 2016-01-24 18:32 Thanks for this topic, it is still usable in 2016. I added by myself Timer with setted interval at 2 minutes and in OnTimer procedure I use Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i mysql_ping(MySQLConnection.Handle); Do you think it is a good solution?