Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-12

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

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ERICK VAN ZYL

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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141228/d832e47b/attachment.html>

Reply by email

Michael Van Canneyt
to ERICK VAN ZYL
ERICK VAN ZYL wrote 10 lines
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.

Reply by email

ERICK VAN ZYL
to Michael Van Canneyt
Michael Van Canneyt wrote 24 lines
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.

Show quoted text 5 lines
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?

this allows you to catch the mysql error, close and re-open the connection.
Show quoted text 9 lines
Michael. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141228/c707a59e/attachment.html>

Reply by email

Michael Van Canneyt
to ERICK VAN ZYL
ERICK VAN ZYL wrote 30 lines
On 28 December 2014 at 17:18, Michael Van Canneyt 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.

Reply by email