ZConnection hangs for nonexistent server

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
jfr
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 11.04.2009, 07:17
Location: Warszawa
Contact:

ZConnection hangs for nonexistent server

Post by jfr »

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.
zash3000
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 13.10.2010, 15:19
Location: Bulgaria

Post by zash3000 »

I have the same problem.
I have tried the same, before I came here.

Somebody tell us how to set a reasonable timeout, please.
guidoaerts
Senior Boarder
Senior Boarder
Posts: 93
Joined: 01.07.2009, 16:07

Post by guidoaerts »

maybe you find something in this thread:
http://zeos.firmos.at/viewtopic.php?t=2049
Guido
zash3000
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 13.10.2010, 15:19
Location: Bulgaria

Post by zash3000 »

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.
guidoaerts
Senior Boarder
Senior Boarder
Posts: 93
Joined: 01.07.2009, 16:07

Post by guidoaerts »

There are two ways to explore this:
ZConnection.Pingserver looks for the server or
in Zconnection.properties you can add 'timeout=120' (but i don't know for sure if that is the right way)...
guido
duzenko
Senior Boarder
Senior Boarder
Posts: 53
Joined: 17.06.2009, 11:24

Re: ZConnection hangs for nonexistent server

Post by duzenko »

Does Ping not only work for if there is a connection already?
I.e. you can't test for Ping before Connect
Post Reply