#1 2023-05-02 20:33:24

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

How to close a database connection?

Somewhere in the forum, I read that if a database connection becomes unusable (eg. out of sync messages, transactions problems, etc) it is better to close it.
Is it possible to that for connections used by TrestServerDB? Is it possible to request to refresh all connections of its connection pool?
The database connection could be through zeos or a TSqlDBPostgresConnection

Thank you in advace

Offline

#2 2023-05-03 06:33:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: How to close a database connection?

The framework is able to re-connect after a timeout is expired, or re-create the connection in case of connection-related exception.
This is at mormot.db.sql level, not at REST nor ORM level.

In short, you have nothing to do, the TSqlDBConnectionProperties does it for you with the proper ConnectionTimeOutMinutes and ReconnectAfterConnectionError properties.
See the documentation on those properties.

Offline

#3 2023-05-03 07:07:48

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

Re: How to close a database connection?

Thank you a lot @ab I will try it

Offline

Board footer

Powered by FluxBB