[Lazarus] Connection lost after a long inactivity with my Lazarus Application using MySQL/MariaDB;

Michael Van Canneyt michael at freepascal.org
Sun Dec 28 16:18:04 CET 2014



On Sun, 28 Dec 2014, ERICK VAN ZYL wrote:

> Good day all,
> 
> I'm new like Databases in Lazarus,
> 
> I have noticed a connection problem while using my Lazarus application with database like MySQL/MariaDB; after a long inactivity with my Lazarus Application using MySQL, the application lost a connection with the database until
> I have to restart the apps. Even after opened and closed the connection, It that’s not work until I have to restart the apps.
> 
> If I used another database like SQLite, the problem didn't occur (I don't have to restart the Apps for further DB request).
> 
> Can any one assist me regarding this issue?

There is no proper solution for this. 
This is the mysql client engine that throws this error.

We have created a helper workaround for this in TSQLConnection:
procedure Close(ForceClose: Boolean=False);
Using this, you can forcedly close the connection.

this allows you to catch the mysql error, close and re-open the connection.

Michael.


More information about the Lazarus mailing list