bin-bin bin-bin - 26 days ago 14
C++ Question

QPSQL driver not loaded Qt

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

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.

Thanks!