Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Multi-thread connect to mysql problem
songzhao831 last edited by
I meet problems when do the multi-thread access mysql on QT5.2.1. i tried many times for mysql open and access like below,
- open connection in main(), and in other thread, only use query to access. the issue is lost mysql connection after a while.
- open connection in each thread. but need remove the connection when the thread end. but meet the scope issue."'qt_sql_default_connection' is still in use"
The source code is blow. when many connection coming at the same time, program crash.
Do you have any idea?
The source code is too long, please open this link.http://www.qtcn.org/bbs/read-htm-tid-56216.html