ping connection take long time

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
necmetdin
Posts: 6
Joined: Wed 12 Nov 2014 10:51

ping connection take long time

Post by necmetdin » Wed 12 Nov 2014 11:01

i am having some problems with a app i am writing for android

I use ping to check if connection is valid
code below:
try{
MyConnection1->Ping();
ShowMessage("ping succes");
.....
.....
}
catch(...)
{
ShowMessage("ping CRASHH");
}

when i run code and component is connected there is no problem.
but then i shutdown the mysql server.
then i run the code. it takes 1 minute before it detects there is no connection.

is this the right way to check for mysql connection? if yes, please tell me why it takes long.

i use embarcadero XE6. cpp
MyDac 8.3.9

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

Re: ping connection take long time

Post by ViktorV » Fri 14 Nov 2014 09:27

You are using the TMyConnection->Ping method correctly for checking the MySQL server connection status. Unfortunately, we couldn't reproduce the problem. When trying to reproduce, the TMyConnection->Ping method returns the result with no delay. This issue may be due to your system configuration.

necmetdin
Posts: 6
Joined: Wed 12 Nov 2014 10:51

Re: ping connection take long time

Post by necmetdin » Fri 14 Nov 2014 09:34

Rhank you for answering my post.
but can you tell me where to look?

is it in my mysql configuration? or somewhhere else?

necmetdin
Posts: 6
Joined: Wed 12 Nov 2014 10:51

Re: ping connection take long time

Post by necmetdin » Fri 14 Nov 2014 10:22

foir testing purpose i create windows application.
here i see directly (2 - 3 seconds) that mysql is not available.
so it is only on android where it takes a long time

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

Re: ping connection take long time

Post by ViktorV » Fri 14 Nov 2014 10:43

Please try to decrease the value of the TMyConnection->ConnectionTimeout property (for example, to 3) and check if the problem still persists.

necmetdin
Posts: 6
Joined: Wed 12 Nov 2014 10:51

Re: ping connection take long time

Post by necmetdin » Fri 14 Nov 2014 10:59

Oke, i tried 0, 1, 3. default is 15. still takes long time

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

Re: ping connection take long time

Post by ViktorV » Mon 17 Nov 2014 09:01

Replace your code with the following and check whether the delay occurs on an attempt to establish a connection (MyConnection1->Connect()) or when calling the MyConnection1->Ping() method:

Code: Select all

MyConnection1->Connect();
try{
MyConnection1->Ping();
ShowMessage("ping succes");
}
catch(...)
{
ShowMessage("ping CRASHH");
}

necmetdin
Posts: 6
Joined: Wed 12 Nov 2014 10:51

Re: ping connection take long time

Post by necmetdin » Tue 18 Nov 2014 09:12

i start app with mysql donw state
connect() function takes long. it takes 1 minute before i get error.

then i restart app with mysql online.
it takes 2 a 3 seconds to connect.

next thing i put mysql down.
this time ping() function takes long. (1 minute)
connect funtion takes less then 1 second.

necmetdin
Posts: 6
Joined: Wed 12 Nov 2014 10:51

Re: ping connection take long time

Post by necmetdin » Thu 20 Nov 2014 12:37

Please can someone help me futher with this issue

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

Re: ping connection take long time

Post by ViktorV » Fri 30 Jan 2015 10:52

Please update MyDAC to the latest (8.4.13) version and check if the problem is reproduced on the new version.

Post Reply