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

Michael Van Canneyt michael at freepascal.org
Sun Dec 28 18:30:54 CET 2014



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

> 
> 
> On 28 December 2014 at 17:18, Michael Van Canneyt <michael at freepascal.org> wrote:
> 
>
>       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.
> 
> Thanks Michael.
>
>       We have created a helper workaround for this in TSQLConnection:
>       procedure Close(ForceClose: Boolean=False);
>       Using this, you can forcedly close the connection.
> 
> I will try it.
> Beside been Non-Visual component (TSQLConnection), what is the difference between the TSQLConnection and TSQLConnector?

TSQLConnector is useful if you want to connect with multiple databases. 
Use a TSQLConnection descendent if you need to connect only with 1 type of database.

Michael.


More information about the Lazarus mailing list