Jump to content
TreyUsesDelphi

suppress connection killed/ gone away dialog

Recommended Posts

I am using FireDac and MySql.  Autoreconnect is set to True in my FDConnection.  My applications are usually left running overnight (without any database activity).  When my users return to the application in the morning, they are met with a dialog "connection was killed" and/or "connection has gone away".  I assume this is happening because of a timeout or as a part of the overnight backup of the database.  Anyway, the connection is reconnecting without any issues and the users are able to continue working after they click the ok button on the dialog.  Is there any way to stop the dialog from coming up at all?.  

Share this post


Link to post

Is there an exception handler around the query that throws the dialog?
We've wrapped all queries in such a way that if we get a disconnect, and the query throws an exception, we explicitly reconnect and try again.
Note that we don't use the DB aware components - so I am not sure how to deal with a disconnect situation in that case, but you need to somehow handle the exception to avoid the default dialog.

Share this post


Link to post

Likely the reconnect failed and latter on after the error dialog is closed the connection gets opened again and the application continues on.

 

A FDConnection has some events to give you a chance to handle exceptions or log what is happening: OnError, OnLogin, OnLost, OnRecover and OnRestored.  If you add some logging to OnLost with a timestamp you should be able to tell what is going on and when. 

Edited by Brian Evans

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×