You are not logged in.
Pages: 1
How the mORMot deal with database connection lost. I'm going to use it with MS SQL and set the ORM to async mode. What's happening if I'll cut the cable between ORM machine and database, the OLE DB I'm using does not inform about connection problems.
Offline
It will report the problem as an Exception to the ORM, I guess.
Note that there is a ConnectionTimeOutMinutes property available for automatic regular reconnection.
I tried to add automatic reconnection in the SynDB units if needed - as it does already for the TQuery wrapper.
It should work directly with the ORM.
Please check https://synopse.info/fossil/info/6d5a0a2e6b
Feedback is welcome!
Offline
@ab - I think re-connection should be on the ORM layer, not on the DB access layer. In case we lost a connection in the middle of the transaction re-connection does not make sense and can broke all business logic in the unexpected way.
In our ORM implementation we check conn.LastErrorWasAboutConnection in the except block of the ORM method execution, and in case exception is about connection - remove all DB connection from the thread pool using TSQLDBConnectionPropertiesThreadSafe.ClearConnectionPool.
User got an error in this case, transaction is rollbacked by DB server. Next ORM request will try to esteblish a new connection
In any case I ask to set a default for AllowReconnect to false in NewStatementPrepared to prevent possible breaking changes
Last edited by mpv (2020-01-31 16:28:50)
Online
Please try https://synopse.info/fossil/info/6d3c115472
Feedback is welcome!
Offline
Pages: 1