TreyUsesDelphi 0 Posted January 19, 2022 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
Lars Fosdal 1792 Posted February 18, 2022 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
Brian Evans 105 Posted February 22, 2022 (edited) 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 February 22, 2022 by Brian Evans Share this post Link to post