The problem is that the database connection can be unstable, so at the beginning of the program it is easy to check this with if(!db.open())
. But some cases can happen while the application is running.
The point is if db.open()
is false. I still need to try and send queries to the DB, so the question is whether does query.exec("...")
tries to re-open the database connection if the database is available now, or do I need to do db.open()
sooner?
Note. My application is a service running in the background and it is trying to send queries to the DB in an infinite loop and I need to handle an unstable connection.