Abort ExecSQL

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
maennie
Posts: 5
Joined: Tue 17 May 2011 07:47
Location: Italy

Abort ExecSQL

Post by maennie » Tue 17 May 2011 07:57

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

AndreyZ

Post by AndreyZ » Tue 17 May 2011 13:26

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.

maennie
Posts: 5
Joined: Tue 17 May 2011 07:47
Location: Italy

Post by maennie » Tue 17 May 2011 14:03

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?

AndreyZ

Post by AndreyZ » Wed 18 May 2011 08:53

In this case you can only use the TIBCQuery.BreakExec method to break the query execution.

maennie
Posts: 5
Joined: Tue 17 May 2011 07:47
Location: Italy

Post by maennie » Wed 18 May 2011 09:10

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.

tsteinmaurer
Posts: 52
Joined: Thu 17 Dec 2009 08:25

Post by tsteinmaurer » Wed 18 May 2011 10:53

I think the only way to not freeze the main thread is to execute your stuff in a separate thread.

maennie
Posts: 5
Joined: Tue 17 May 2011 07:47
Location: Italy

Post by maennie » Thu 19 May 2011 08:31

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?

AndreyZ

Post by AndreyZ » Thu 19 May 2011 11:21

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.

maennie
Posts: 5
Joined: Tue 17 May 2011 07:47
Location: Italy

Post by maennie » Thu 19 May 2011 11:49

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

AndreyZ

Post by AndreyZ » Thu 19 May 2011 14:19

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.

Post Reply