Reputation: 15930
It works, the first time I installed postgres 64bit, while Qt uses MinGW 32 bit.
Following the answer linked by zapredelom, I installed postgres 9 and added to PATH the bin
and lib
directories. To be sure, I also restarted the machine, but nothing changed. QT_DEBUG_PLUGINS=1
gives me no additional debug infos.
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.
What's the problem?
Upvotes: 2
Views: 3118
Reputation: 2668
The driver does not work because it does not find the dependency (it should be depends on libpq.dll), and when you run it, the plugin can not find the required dll. If you are using windows, just try to check using dependencywalker of the qsqlpsql.dll.
You can directly put your libpq.dll to your application exe folder.
Upvotes: 1