QPSQL driver not loaded Qt

I have some problems 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 in the variables the paths PATHto:

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

I will also copy the folder sqldriversto Debug. Also tried copy dll drom from this folder to Debug. Does not work.

+3
source share
3 answers

I came here googling because I had the same problem on Windows.

In my case, to solve the problem, I had to install PostgreSQL for Windows 32 bits, since my Qt target was 32 bits MinGW.

, PATH bin lib PostgreSQL, Qt .dlls.

@SET PATH=C:\Program Files (x86)\PostgreSQL\9.6\bin\;C:\Program Files (x86)\PostgreSQL\9.6\lib\;%PATH%

PATH Qt Creator Qt Creator Build Environment Projects.

0

QT_DEBUG_PLUGINS=1, , QPSQL .

, , Qt . , , .

+5

depend.exe qsqlpsql.dll , dll libpq.dll PostgreSQL\9.3\lib. libpq.dll Debug, :)

+2
source

All Articles