Driver not loaded, but driver is present



  • I get this error at runtime:

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

    As the error itself displays, postgres driver is already present. Indeed there's a qsqlpsql.dll and qsqlpsqld.dll under C:\Qt\5.8\mingw53_32\plugins\sqldrivers.
    I have not built it and I have no Postgres installation on this machine (I test on my Linux OS and deploy on Windows 8.1 VM), the driver was already present after installing QT.
    Please help me.



  • @Marco-Sulla
    Beside plugins for sqldrivers you need drivers itself. For PostgreSQL 9.6 the necessary files are these:

    libeay32.dll
    libiconv-2.dll
    libintl-8.dll
    libpq.dll
    ssleay32.dll
    

    Place them in the folder of your *.exe file.
    You can get them from zip archive of the binaries if you don't want to install PostgreSQL.
    Note that you will need files for the same system version like your Qt version.
    For example:
    If you use MinGW32 (witch is only 32-bit) you need these files from 32-bit version of PostgreSQL.
    If you use MSVC x64 you need these files from 64-bit version of PostgreSQL.


Log in to reply
 

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