Important: Please read the Qt Code of Conduct -

QPSQL driver not loaded -> available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

  • Hello

    I'm relatively new to QT and C++.

    I've experience in PHP (OOP), Webdevelopement and C.
    Just for imagine with whom you are working with ;).

    I'm working on windows 7 64 Bit.
    QT 5.10.0 and Visual Studio Community 2017 15.5.1.

    I'm working here with somebody who created a program which connects to a PostgresSQL 9.3 all works fine for him. So now I just want to support him and installed everything (already multiply times).

    But I always get the same error:
    "QSqlDatabase: QPSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7"

    I already tried to build the driver by my self but there are many things different to the instructions and got a lot of errors.
    Then I loaded the books example ( it just works fine.

    Now I change this to QPSQL and I get the exactly same error.

    QSqlError initDb()
           QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
           bool ok =;

    I don't know if I'm correct but i'm thinking I should get something like "Wrong username/password can't connect" or "Can't connect to database" instead of the driver....
    => Ok just tested.... my workmate (where it is working) get another message the one I would expect...

    So I already tried everything I'm able to.

    Anyone any idea what I should do?
    I just want that the driver works!

    Thank you very much

  • @noIdea
    It seems that drivers for PostgreSQL are missing (not deployed).
    Example works because it uses SQLite and its drivers are integrated in Qt.
    Look at this for what is necessary for PostgreSQL:

  • libeay32.dll

    copied these files from "\PostgreSQL\9.3\bin"
    (libiconv-2.dll doesn't exist)

    and it works!

    Thank you very much :)

  • @noIdea said in QPSQL driver not loaded -> available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7:

    (libiconv-2.dll doesn't exist)

    The file "libiconv-2.dll" does exist and is necessary for PostgreSQL 9.4 and later.

Log in to reply