Multi-thread connect to mysql problem



  • Hi guys,

    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,

    1. open connection in main(), and in other thread, only use query to access. the issue is lost mysql connection after a while.
    2. 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.