Page 1 of 1

Abort ExecSQL

Posted: Tue 17 May 2011 07:57
by maennie
Hello,

i have a question about the TIBCQuery.
It's possible to abort the ExecSQL if the Firebird Server host is not reachable?

We have the big Problem, that we must work with a remote Database in a very unstable Network over WLAN.
We need something like a ConnectionTimeout which aborts the Execution (f.e. after 5 seconds) and the GUI don't freeze for about 30 seconds.

Thanks in advance
Manuel

Posted: Tue 17 May 2011 13:26
by AndreyZ
Hello,

If the Firebird server cannot be reached, any query execution attempt will result in an exception, and no execution will be performed on the server. If server is available, you can break execution by calling the TIBCQuery.BreakExec method. You should call this method from another thread. For more information, please read the IBDAC documentation.

Posted: Tue 17 May 2011 14:03
by maennie
Hello,

thank you for your answer.
Our Problem is that often the connection to the Firebird Server fails during the "ExecSQL" or "Execute". In this case the Exception comes after about 30 seconds. In the meantime the Application Hangs up.

Is there a possibility to prevent this long hang up?

Posted: Wed 18 May 2011 08:53
by AndreyZ
In this case you can only use the TIBCQuery.BreakExec method to break the query execution.

Posted: Wed 18 May 2011 09:10
by maennie
The BreakExec Function works only if the Fierebird Server is reachable over TCP/IP because its internaly calling the fb_cancel_operation. We have also testet this case but BreakExec works only if Firebird Host Server is reachable.

Posted: Wed 18 May 2011 10:53
by tsteinmaurer
I think the only way to not freeze the main thread is to execute your stuff in a separate thread.

Posted: Thu 19 May 2011 08:31
by maennie
Yes, we call the "ExecSQL" or "Execute" method in a separate thread to prevent the freeze of the main thread. The main thread so don't freeze but the thread waits about 30 seconds until the exception is fired.
In this time we can not Execute other statements over this thread.
A possible solution is to create more threads, but we search a better solution...

Is there something like the "CONNECT TIMEOUT" in the standart Delphi TDatabase component?

Posted: Thu 19 May 2011 11:21
by AndreyZ
I've checked the situation when remote connection breaks during query execution on Firebird 2.5. Almost immediately after connection loss the "Error reading data from the connection" and "Error writing data to the connection" exceptions arise in the application.

Posted: Thu 19 May 2011 11:49
by maennie
If i create a new empty Delphi Application, place a IBCConnection, IBCTransaction and a IBCQuery on the Form and then execute a long statement on a Firebird 2.5 Server it takes on connection lost about 30 seconds until i receive the "error reading data from the connection" Exception.

What is going wrong?

Used components:
Delphi 2009
Firebird 2.5
IBDac 3.60

Posted: Thu 19 May 2011 14:19
by AndreyZ
Hello,

Please try connecting to your server with telnet in the following way:

Code: Select all

telnet server 3050
This way you can check the speed of your network.
We cannot influence such behaviour of Firebird server. We use the standard Firebird library fbclient.dll to connect to the server. You can try using other versions of this library.
If the problem persists, please write about it to the Firebird support.