Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QSqlDatabase: QPSQL driver not loaded - linux ubuntu



  • Hi to all
    I built a new ubuntu 18.04 virtual machine,
    i have installed
    apt-get install postgresql
    apt-get install postgresql
    apt-get install libpq-dev
    apt-get install libpq-dev python-dev
    sudo apt-get install libqt5sql5-psql
    apt-get install postgresql-client
    From repositories was installed the version of postgres
    Then i installed qt from online installer and i using 5.15.2 version
    QSqlDriver give message QPSQL is present but give me the message Driver not load.
    This is installation is on hyper-v virtual machine
    another installation on vmware machine tries to load the library with -avx2 postfix and gives me the same error

    There is anyone can help me?



  • @ellorenz
    Always the same answer for this question: you need to set environment variable export QT_DEBUG_PLUGINS=1 and run your application, it will send diagnostic output to stdout/stderr, you usually need to look at the end of it to see what's failing.



  • @JonB Found the problem sorry

    If you declare

    QSqlDatabase database
    database.addDatabase("QPSQL");

    instead of
    QSqlDatabase database = QSqlDatabase::addDatabase("QPSQL");

    It lost drivers pointer at open function


Log in to reply