Unsolved MYSQL database connection verification
-
Hello there
I'm programming in RPi (C++) for an application that uses a MYSQL database.
This Database it's on another station and connected thru network, I need to verify when the other station is online or not.
At first I connect with no problem but if the other station its turned off I never know until my application stops responding.Any advise... thanks
-
I already add problem with MySQL's connection and I didn't found a solution with Qt. But I have time before release so I stopped wondering.
The only ideas I got:
- using some flags for MySQL: MYSQL_OPT_RECONNECT (see: http://doc.qt.io/qt-5/qsqldatabase.html)
But it didn't seem to be functionnal (the library never tried to reconnect; used wireshark). For your case some more flags : MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_READ_TIMEOUT, MYSQL_OPT_WRITE_TIMEOUT. Try it, may be functionnal for you. - build a new driver; didn't do it as it would be time consuming.
- using some flags for MySQL: MYSQL_OPT_RECONNECT (see: http://doc.qt.io/qt-5/qsqldatabase.html)
-
@lemmel Thanks for your advise.