Reputation: 42245
From the documentation, I know how to check MySql connection state in C++
These methods can be used to check the connection state or reconnect:
sql::Connection::isValid() checks whether the connection is alive.
sql::Connection::reconnect() reconnects if the connection has gone down.
Is there a C API to do the same thing?
Upvotes: 1
Views: 2938
Reputation: 3524
Yes, the link you shared is to Connector/C++, which is a C++ API. What you're looking for is Connector/C, or just the regular C API.
mysql_stat
is a function which will return status of the server to tell you if the connection is gone.
Upvotes: 2