QPSL driver is not loaded Win10 MSVC 2015 x64
-
I builded psql plugin using msvc compiler with postgres 9.5.2. Nothing changed.
Please, could anybody say how to debug this situation: why plugin is not loading? There are no logs about this.
Thank you!
-
Hi and welcome to devnet,
Do you also have the folder where the PostgreSQL dlls are in your PATH environment variable ? If not, then simply got to the run part of the Project panel and add it there.
-
@SGaist
Yes, global %PATH% includes paths to PostgreSQL's dlls:
https://yadi.sk/i/DP7N4Xx8qvCSBAnd these dll is in a root near a project binaries:
ssleay32.dll, iconv.dll, libeay32.dll, libiconv-2.dll, libintl-8.dll, libpq.dll, libxml2.dll, libxslt.dll, zlib1.dll
P.S.
I'm modified psql driver code by appending some output to console, but nothing appears at console after driver loading:
QSqlDriver* QPSQLDriverPlugin::create(const QString &name) { if (name == QLatin1String("QPSQL") || name == QLatin1String("QPSQL7")) { QPSQLDriver* driver = new QPSQLDriver(); std::cout << "Driver loaded by main"; return driver; } std::cout << "Driver not loaded by main"; return 0; }
-
After re-reading your plugin loading output, there something strange, did you copy the plugin in your application after building it ?
It should rather go in Qt's plugins SQL sub folder
-
I'm sorry.
Using command line to start application:
@echo off MoneyManagement.exe > out.txt
I see this in file "out.txt":
Driver loaded by main
In lastSqlError variable the same:
Driver not loaded Driver not loaded
And there are no error messages in MSVC output.
What I have to do?
P.S.
After appending debug output to all methods inside "qsql_psql_p.h" I saw this:
Plugin consructor called. private sql driver constructor called QPSQLDriver constructor 1 Driver loaded by mainQPSQLDriver close QPSQLDriver isOpen QPSQLDriver destructor
-
After re-reading your code sample I just realized: you're using QSqlDatabase wrongly. You are currently trying to open an invalid database object.
addDatabase is a static function. See the detailed description of QSqlDatabase to see how it's done
-
That's wrong, don't allocate _sqlBase on the heap.
-
One of the reason is explained in QSqlDatbase::removeDatabase.