Important: Please read the Qt Code of Conduct -

Slow database connection

  • I connect to my database using following code :
    db = QSqlDatabase::addDatabase("QMYSQL");
    if (!


    This seems to work fine when my application is running on local machine
    where the MySql database is running . But when I run the application
    remotely , there is some considerable delay connecting
    to the database . It seems like either the drivers are taking too long to load
    or MySql handles remote connections too slowly .

    Is this a driver issue or is it MySql ? Anybody have a similar problem ?

  • Qt Champions 2017

    Just place the time information between all the instruction & measure the same. One suspect I have is DNS resolution for your server name. Try giving the IP address directly. See how it goes.

Log in to reply