I'm using version 6.6.4 with Delphi 6. Trying to connect to mysql database:
ZConnection.HostName:='ahost';
ZConnection.Protocol:='mysql';
ZConnection.Port:=3306;
ZConnection.User:='root';
ZConnection.Password:='password';
ZConnection.Connect;
And now if ahost address connot be found then program hangs and wait forever. How to avoid it? I've tried to add
timeout=10
to ZConnection.Properties, but it didn't work.
ZConnection hangs for nonexistent server
Moderators: gto, cipto_kh, EgonHugeist
-
- Senior Boarder
- Posts: 93
- Joined: 01.07.2009, 16:07
That thread is about loosing a connection. It's not my case.
My problem appears when I try to connect and the server is down or doesn't exist.
In 1-2 minutes after ZConnection.Connect there raises an exception, but this time is too long. I need to fix timeout to a shorter period, like 5-10 seconds.
Give another answer, please.
My problem appears when I try to connect and the server is down or doesn't exist.
In 1-2 minutes after ZConnection.Connect there raises an exception, but this time is too long. I need to fix timeout to a shorter period, like 5-10 seconds.
Give another answer, please.
-
- Senior Boarder
- Posts: 93
- Joined: 01.07.2009, 16:07
Re: ZConnection hangs for nonexistent server
Does Ping not only work for if there is a connection already?
I.e. you can't test for Ping before Connect
I.e. you can't test for Ping before Connect