How do I reopen lost connection?
How do I reopen lost connection?
Okay, I can't seem to figure this out.
I'm connected to the database, I have a bunch of events registered in my app.
I stop Firebird using the control panel applet.
I get the "unknown ISC error 0" messages (thanks for the fix, btw)
Then I display a dialog that would allow my users to reconnect to the database.
I restore the connection in my test manually (using the control panel applet), then I make my program call IBCConnection.Connect, then I run a custom query. (IBCQuery.Open)
The result:
"Error writing data to connection" message.
I've tried disconnecting then reconnecting but with no luck. If I create a new TIBCConnection object it can connect, but the old one can't seem to connect again.
How do I reconnect once the connection has been cut off then restored to the server?
Thanks!
I'm connected to the database, I have a bunch of events registered in my app.
I stop Firebird using the control panel applet.
I get the "unknown ISC error 0" messages (thanks for the fix, btw)
Then I display a dialog that would allow my users to reconnect to the database.
I restore the connection in my test manually (using the control panel applet), then I make my program call IBCConnection.Connect, then I run a custom query. (IBCQuery.Open)
The result:
"Error writing data to connection" message.
I've tried disconnecting then reconnecting but with no luck. If I create a new TIBCConnection object it can connect, but the old one can't seem to connect again.
How do I reconnect once the connection has been cut off then restored to the server?
Thanks!
If I call disconnect before connect, it raises an "Error writing data to connection" message!
If I stop the firebird server
handle the unknown isc error 0 error in my program
relaunch the firebird server
call connect
then the "Error writing data to connection" message comes when I want to execute a query.
If I call disconnect (after relaunching the server), I get the "Error writing data to connection" message instantly, and after that, I call connect, and when executing a query, I get "can't perform operation on inactive transaction message".
What should I do to solve the problem?
Thanks!
If I stop the firebird server
handle the unknown isc error 0 error in my program
relaunch the firebird server
call connect
then the "Error writing data to connection" message comes when I want to execute a query.
If I call disconnect (after relaunching the server), I get the "Error writing data to connection" message instantly, and after that, I call connect, and when executing a query, I get "can't perform operation on inactive transaction message".
What should I do to solve the problem?
Thanks!
I have reproduced the problem with your last sample. I could not find the difference between two samples but when I recompile the last sample I can reproduce the problem, and with the previous sample I cannot.
When I modify your sample in the following way, no error message is shown:
When I modify your sample in the following way, no error message is shown:
Code: Select all
try
IBCConnection1.Disconnect;
except
on EIBCError do ;
end;
IBCConnection1.Connect;
IBCQuery1.SQL.Text:='SELECT * FROM Test';
IBCQuery1.Open;
Hi Plash!
You're right that the try/except block solves the problem in the example I sent you, but not in my main application, based on which I made the example!
In my main application where I experienced the error first, if I try to put the disconnect call in a try/except block the exception is handled and IBCConnection manages to reconnect.
But upon executing a query I'm getting the 'Can't perform operation on inactive transaction' error message, no matter what I do.
On the other hand, if I put a second connection component on the form and use that for reconnecting, no error occurs!
Thus, I'm supposing that there is something changed in IBCConnection's state after a forced disconnect, which won't let you reconnect normally.
If you have any ideas on what might be causing this part of the problem please let me know.
Otherwise I'll try to make another example later today to reproduce the new problem!
Thank you!
You're right that the try/except block solves the problem in the example I sent you, but not in my main application, based on which I made the example!
In my main application where I experienced the error first, if I try to put the disconnect call in a try/except block the exception is handled and IBCConnection manages to reconnect.
But upon executing a query I'm getting the 'Can't perform operation on inactive transaction' error message, no matter what I do.
On the other hand, if I put a second connection component on the form and use that for reconnecting, no error occurs!
Thus, I'm supposing that there is something changed in IBCConnection's state after a forced disconnect, which won't let you reconnect normally.
If you have any ideas on what might be causing this part of the problem please let me know.
Otherwise I'll try to make another example later today to reproduce the new problem!
Thank you!