Sign in Join

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

Mailing lists / lazarus / 2012-12

TMySQL51Connection: Keep connection alive

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Andrey Smyntyna

Hello.

I need some explanation of how to do persistent connection to MySQL database and restore it if it has broken.

In my test project I have created TMySQL51Connection component with KeepConnection property set to True
and additionaly before making any database operations I check connection availability like below:

  if not dm.mysql.Connected then
      dm.mysql.Connected := True;

But sometimes I anyway get connection error with the fact that MySQL server is present and available in network.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121205/703ced5d/attachment-0001.html>

Reply by email

Unknown author
to Andrey Smyntyna
Andrey Smyntyna wrote 15 lines
Hello. I need some explanation of how to do persistent connection to MySQL database and restore it if it has broken. In my test project I have created TMySQL51Connection component with KeepConnection property set to True and additionaly before making any database operations I check connection availability like below: if not dm.mysql.Connected then dm.mysql.Connected := True; But sometimes I anyway get connection error with the fact that MySQL server is present and available in network.

As far as I know, the 'Keepconnection' is not functional.

Michael.

Reply by email

Andrey Smyntyna
to Unknown author

With MYSQL_OPT_RECONNECT=1 provided code works like expected

2012/12/5

Show quoted text 32 lines
On Wed, 5 Dec 2012, Andrey Smyntyna wrote: Hello. > > I need some explanation of how to do persistent connection to MySQL > database and restore it if it has broken. > > In my test project I have created TMySQL51Connection component with > KeepConnection property set to True > and additionaly before making any database operations I check connection > availability like below: > > if not dm.mysql.Connected then > dm.mysql.Connected := True; > > But sometimes I anyway get connection error with the fact that MySQL > server > is present and available in network. > As far as I know, the 'Keepconnection' is not functional. Michael. -- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

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

Reply by email