Is there any propertie to keep always connected?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Diego_Foli
Posts: 2
Joined: Thu 09 May 2019 15:34

Is there any propertie to keep always connected?

Post by Diego_Foli » Tue 21 May 2019 14:36

My question is; Every time I do a TMquery.Open or TMquery.ExecSql it trigger the BeforeConnect Event, witch means it was Disconnected.
Is that Right? is there any propertie to just connect one time and Keep Connected until I Disconnect?

Obs: I'm sorry if it is a dumb question.

ViktorV
Devart Team
Posts: 2793
Joined: Wed 30 Jul 2014 07:16

Re: Is there any propertie to keep always connected?

Post by ViktorV » Tue 21 May 2019 14:59

Diego_Foli wrote:
Tue 21 May 2019 14:36
My question is; Every time I do a TMquery.Open or TMquery.ExecSql it trigger the BeforeConnect Event, witch means it was Disconnected.
Is that Right?
Yes, you are right.
Diego_Foli wrote:
Tue 21 May 2019 14:36
is there any propertie to just connect one time and Keep Connected until I Disconnect?
Obs: I'm sorry if it is a dumb question.
To solve your task you can use the TMyConnection.Ping method. This method can be used in order for the server not to close a connection due to timeout connection activity. In this case, you can use TMyConnection.Ping as follows - call it from the timer and set the interval timer to a value less than wait_timeout of the server (so that the intervals between commands receiving by the server do not exceed wait_timeout).

Post Reply