Search code examples
c++soci

How to register a DB failover callback in SOCI?


I connect to the database using the SOCI library and I want to obtain database fail-over events for logging purposes. I'm not sure what interface to implement and how to do the callback registration. Is there such support in SOCI?


Solution

  • The only failover notifications supported by SOCI are for connections.

    The failover_callback interface can be used as a callback channel for notifications of events that are automatically processed when the session is forcibly closed due to connectivity problems.

    See the interface details at https://github.com/SOCI/soci/blob/master/docs/connections.md