Page 1 of 1

executedirect timeout

Posted: 11.09.2010, 19:16
by garynorton
I am rewriting a cashregister POS program that was originally written in C++ into Lazarus
Everything working well with exception of handling network failures to a remote Postgres database.

If the network goes down while trying to connect to the ZConnection an exception occurs correctly after the preset timeout.

If the connection opens correctly then the network plug is pulled prior to performing a Zconection.executedirect('update table set .....) statement then the program hangs and never returns even after network is reestablished.

It seems the network connection timeout does not function when performing an executedirect.

Any help would be appreciated.

Posted: 19.09.2010, 21:31
by mdaems
Did you try setting timeout=<n> in the TZConnection properties?
In case you didn't :
postgres documentation wrote:connect_timeout
Maximum wait for connection, in seconds (write as a decimal integer string). Zero or not specified means wait indefinitely. It is not recommended to use a timeout of less than 2 seconds.
However, I don't know if this has an effect on an already existing connection. Some postgres gurus around that know more about this issue?

Mark

Posted: 20.09.2010, 07:48
by Wild_Pointer
Hello garynorton,

I've investigated the ExecuteDirect implementation for postgres and it seems to me the behavior of ExecuteDirect and TZQuery.Open should be the same. I guess you encounter the old problem of lost connection that led to Access violation usualy. It was resolved in v7 of Zeos (SVN Rev 789). Please try installing latest zeos from the svn repository and test if the problem still exists.

Hope it helps. Good luck!