ZConnection hangs for nonexistent server

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

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

ZConnection hangs for nonexistent server

Postby jfr » 14.07.2009, 06:15

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

Postby zash3000 » 13.10.2010, 15:22

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

Postby guidoaerts » 13.10.2010, 19:56

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

Postby zash3000 » 14.10.2010, 09:47

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

Postby guidoaerts » 19.10.2010, 17:11

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
Junior Boarder
Junior Boarder
Posts: 32
Joined: 17.06.2009, 11:24

Re: ZConnection hangs for nonexistent server

Postby duzenko » 16.03.2016, 12:38

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


Return to “MySQL”

Who is online

Users browsing this forum: No registered users and 1 guest