On 9 October 2013 11:27, Marc Schmitzer <marc.schmit...@richard-wolf.com> wrote: > While this works well most of the time, we occasionally have queries > fail with "MySQL server has gone away" errors. We know that the mysqld > process has indeed *not* gone away, and re-opening the connection works. > > My theory is that the initial QSqlDatabase::open() creates a connection > to the SQL server that is kept open permanently by the QSqlDatabase > instance that Qt keeps internally (in the ConnectionDict) that > references the same connection. The SQL server eventually closes the > connection after some timeout, which the application doesn't notice > until it tries to use the connection again.
I've seen the same behavior from the python mysql drivers, so I think this is probably the correct explanation. I don't know if the mysql library offers a way to detect when you get disconnected that could be used to make the implementation reconnect automatically. Cheers Rich. _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest