Recent

Author Topic: MySQL: A reconnect after "Server has gone away" error  (Read 7857 times)

hubblec4

  • New Member
  • *
  • Posts: 25
MySQL: A reconnect after "Server has gone away" error
« on: July 16, 2014, 03:35:44 pm »
Hi everyone

I have an issue with the SQLConnection. Sometimes i get this "... gone away"-error.

My aim is it to handle this error with an automaticly reconnect to the Sql-server.

The error is not caused by a timeout! (there are many stuff for this topic but no information for an reconnect)

I use the SQL_Library_Loader, SQLConnector, SQLTransaction, SQLQuery and a DataSource.


I found a public property at the SQLConnector

"SQLConnector.ConnOptions" how i can use this property, which options i can set?


hubble


hubblec4

  • New Member
  • *
  • Posts: 25
Re: MySQL: A reconnect after "Server has gone away" error
« Reply #1 on: July 17, 2014, 11:20:32 am »
When i try SQLConnector.connected:=false i get the same "...gone away"-error.
There is no chance for a reconnect to the SQL-DB. only when i restart my programm.

Or anyone knows how to do that?


LacaK

  • Hero Member
  • *****
  • Posts: 703
Re: MySQL: A reconnect after "Server has gone away" error
« Reply #2 on: July 21, 2014, 09:44:34 am »
Try use SQLConnector.Close(True);
or
SQLConnector.Proxy.Close(True);

Parameter "ForceClose" = True

hubblec4

  • New Member
  • *
  • Posts: 25
Re: MySQL: A reconnect after "Server has gone away" error
« Reply #3 on: July 21, 2014, 11:32:59 am »
ok i will try it.

EDIT: SQL.Connectore.Close(True) dont work, you get the same "gone away -error", cause allways a rollback is attempted.

But we talked in the german forum and we found the bug. (http://www.lazarusforum.de/viewtopic.php?f=17&t=7953)

http://bugs.freepascal.org/view.php?id=26505
« Last Edit: July 21, 2014, 12:04:13 pm by hubblec4 »

LacaK

  • Hero Member
  • *****
  • Posts: 703
Re: MySQL: A reconnect after "Server has gone away" error
« Reply #4 on: July 21, 2014, 01:59:39 pm »
Can you post here any compilable simple application which will show error ?

hubblec4

  • New Member
  • *
  • Posts: 25
Re: MySQL: A reconnect after "Server has gone away" error
« Reply #5 on: July 21, 2014, 04:11:09 pm »
Can you post here any compilable simple application which will show error ?

Sorry not really. I can't extract der Fail-procedure to a simple application.


Michl

  • Full Member
  • ***
  • Posts: 226
Re: MySQL: A reconnect after "Server has gone away" error
« Reply #6 on: July 22, 2014, 12:04:04 am »
I can. Please read the bug tracker entry first. With the one of the last patchs it is possible to execute the two buttonclicks in the .exe. You have to copy "libmysql.dll" in your project order.

I use MySQL 5.6 if you use a other version, you have to change the Connection (with the name Connection!). Parameters are written in the private section of TForm1 and setted in TForm1.FormCreate.
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

 

TinyPortal © 2005-2018