executedirect timeout

Forum related to PostgreSQL

Moderators: gto, cipto_kh, EgonHugeist, olehs

Post Reply
garynorton
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 11.09.2010, 18:52
Contact:

executedirect timeout

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
Wild_Pointer
Expert Boarder
Expert Boarder
Posts: 164
Joined: 18.03.2008, 13:03
Contact:

Post 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!
Post Reply