QPSQL driver not loaded Qt

bin-bin picture bin-bin · Oct 22, 2014 · Viewed 23k times · Source

I have some trouble when I want to add a database.

    _dataBase = QSqlDatabase::addDatabase("QPSQL");

After calling this method I have an error:

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

I include to PATH variable paths to:

PostgreSQL\9.3\bin
PostgreSQL\9.3\lib
PostgreSQL\9.3\include

Also I copy folder sqldrivers to Debug folder. Also tried to copy dlls drom this folder to Debug. Doesn't work either.

Answer

user3657398 picture user3657398 · Oct 22, 2014

Add the system variable QT_DEBUG_PLUGINS=1 if you want to get full information of why the QPSQL driver has not been loaded.

Probably you will discover that Qt is not able to find it. Copy and paste the output here to know what exactly happens.