PDA

View Full Version : QSqlDatabase, MySql, Threads and Debugging environment



Hawkeye64
27th July 2016, 17:29
I have some code that creates a number of runnables using a threadpool to access different tables in the database. These all work when not run from the debugger, when compiled in Debug or Release mode. But, if I run from the debugger these all fail. Keep in mind, this all works when NOT running from the debugger. So, the debugger is causing some interaction issue. Would anyone have any suggestions as to why this is happening?

Here are the specific errors:

"Database Error(2013): Lost connection to MySQL server during query QMYSQL: Unable to open database 'myDatabase'"
"Database Error(2013): Lost connection to MySQL server during query QMYSQL: Unable to open database 'myDatabase'"
"Database Error(2013): Lost connection to MySQL server during query QMYSQL: Unable to open database 'myDatabase'"
Error: QSqlError("2013", "QMYSQL: Unable to open database 'myDatabase'", "Lost connection to MySQL server during query")
Error: QSqlError("2013", "QMYSQL: Unable to open database 'myDatabase'", "Lost connection to MySQL server during query")
"Database Error(2013): Lost connection to MySQL server during query QMYSQL: Unable to open database 'myDatabase'"
Error: QSqlError("2013", "QMYSQL: Unable to open database 'myDatabase'", "Lost connection to MySQL server during query")
"Database Error(2013): Lost connection to MySQL server during query QMYSQL: Unable to open database 'myDatabase'"
Error: QSqlError("2013", "QMYSQL: Unable to open database 'myDatabase'", "Lost connection to MySQL server during query")
Error: QSqlError("2013", "QMYSQL: Unable to open database 'myDatabase'", "Lost connection to MySQL server during query")
"Database Error(2013): Lost connection to MySQL server at 'reading authorization packet', system error: 4 QMYSQL: Unable to connect"
Error: QSqlError("2013", "QMYSQL: Unable to connect", "Lost connection to MySQL server at 'reading authorization packet', system error: 4")
"Database Error(2013): Lost connection to MySQL server at 'reading authorization packet', system error: 4 QMYSQL: Unable to connect"
Error: QSqlError("2013", "QMYSQL: Unable to connect", "Lost connection to MySQL server at 'reading authorization packet', system error: 4")
"Database Error(2013): Lost connection to MySQL server at 'reading authorization packet', system error: 4 QMYSQL: Unable to connect"
Error: QSqlError("2013", "QMYSQL: Unable to connect", "Lost connection to MySQL server at 'reading authorization packet', system error: 4")

anda_skoa
27th July 2016, 18:51
Do you correctly open and close the database connection in each runnable?
Does each runnable use a unique enough connection name?

Cheers,
_