Two critical new featues

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
cmatrix
Junior Boarder
Junior Boarder
Posts: 29
Joined: 20.10.2005, 21:43
Contact:

Two critical new featues

Post by cmatrix »

I think Zeos 7 could benefit enormously by having two very important features.

1. An event that fires when the connection is lost. This is very important in unstable environments like wireless networks.

2. A timeout property for ZConnection. Now with certain DBs (like I'm seeing now with MS SQL on ADO) a Zeos app will hang indefinitely if the connection parameters are invalid. I understand this can be mitigated on certain DBs like My SQL by changing certain properties. But it would be extremely convenient for Zeos to handled this internally.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

cmatrix,

Theire is a way to determine ConnectionLost for MySQL and Oracle(\testing 7.1 (SVN)):

Code: Select all

if TZConnection.DbcConnection.PingServer = 0 then
  //Success
else
  //disconnected
...
Timeout can be settet too defaults of MySQL:
http://stackoverflow.com/questions/2436 ... n-in-mysql

But you can use

Code: Select all

TZConnection.Properties.Values['timeout'] := '60';

too. See ZDbcMySQL.pas:

Code: Select all

...
    ConnectTimeout := StrToIntDef(Info.Values['timeout'], 0);
    if ConnectTimeout >= 0 then
      GetPlainDriver.SetOptions(FHandle, MYSQL_OPT_CONNECT_TIMEOUT, PAnsiChar(@ConnectTimeout));
...
Is this answer sufficient?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
cmatrix
Junior Boarder
Junior Boarder
Posts: 29
Joined: 20.10.2005, 21:43
Contact:

Post by cmatrix »

Pinging the DB server before every data access is very inconvenient. I think an OnLostConnection event would be very useful.

In my experience setting the timeout in .Properties has never worked (in MySQL anyway). I'll try looking into that further.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

cmatrix,
Pinging the DB server before every data access is very inconvenient. I think an OnLostConnection event would be very useful.
Yes i know Pinging allways is inconvenient. I was thinking about an Improvement with a TThread which can do the job..
In my experience setting the timeout in .Properties has never worked (in MySQL anyway). I'll try looking into that further.
Well i've no idea if it works. Please test it. Again: The MySQL defaults are 2700 secs. If you're more patiant (; little joke...


Any proposals for such an event?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Post Reply