[Qt-interest] QtSql connection timeout error

Thomas Fjellstrom tfjellstrom at shaw.ca
Thu Sep 17 20:30:33 CEST 2009


I've created a little long running process (a server), which connects to MySQL 
through the QtSql api, but occasionally the mysql connection times out due to 
inactivity (i assume). I've tried checking connection.isOpen(), 
connection.isValid(), and the connection.lastError(), but none of them seem to 
hint that there's even been a problem. isOpen returns true, isValid returns 
true, and lastError().code() is QSqlError::NoError but every single 
query.exec() fails.

I'm stumped. How can I reliably detect when the connection drops like this?

-- 
Thomas Fjellstrom
tfjellstrom at shaw.ca



More information about the Qt-interest-old mailing list