Unsolved Postgresql driver is not found
-
Then run Dependency Walker on these.
The next likely candidate is the VC runtime dll. -
@SGaist
I think that library is not in business. -
I meant that you should run Dependency Walker on the OpenSSL dlls and that it would have likely been the VC runtime missing.
-
It looks like infinite loop…
-
Did you copy the VC runtime in the same folder as the OpenSSL library ?
-
@alxdef Your first screenshot tells you that libstdc++-6.dll is missing.
-
@Christian-Ehrlicher said in Postgresql driver is not found:
@alxdef Your first screenshot tells you that libstdc++-6.dll is missing.
Arf ! I missed that one. Good catch :-)
-
These libs are present in my app executable folder:
sqldrivers\qsqlpsql.dll platforms\qwindows.dll vcruntime140.dll Qt5Sql.dll Qt5Core.dll msvcrt.dll libstdc++-6.dll libssl-1_1-x64.dll libpq.dll libintl-8.dll libcrypto-1_1-x64.dll
-
So there are no ideas…
-
Did you get libpq from the official site? I've just had a try.
I think it is probably due to the file you were all ignoring:libintl-8.dll
--> it depends onlibiconv-2.dll
, which you didn't copy.
When you use Dependency Walker on libpq.dll, check all the yellow icons, not only in the upper part tree, but also in the lower part list (those are all the dlls recursively)...
But there may also besomemany "false alarms", especially those dlls needed by system dlls / vc runtimes (e.g.: api-ms-...), you'll need to distinguish them by yourself.
I mainly check those start with "lib" (MinGW style) and "q" (Qt libs).
Or you can manually expand all the tree items recursively, just skip when it is a system / vc runtime. -
@Bonnie
Thanks for advice. Now application debug output looks like this:Got keys from plugin meta data ("QPSQL7", "QPSQL") loaded library "…/debug/sqldrivers/qsqlpsql.dll" QFactoryLoader::QFactoryLoader() checking directory path "…/debug/accessible" ... QFactoryLoader::QFactoryLoader() checking directory path "…/debug/accessiblebridge" ... QLibraryPrivate::unload succeeded on "…/debug/sqldrivers/qsqlpsql.dll" QLibraryPrivate::unload succeeded on "…/debug/platforms/qwindows.dll" 21:31:17: *.exe exited with code 0
But I still catch "Driver not loaded" using this code:
if (!this->app_conn.isValid()) { //… } if (!this->app_conn.open()) { //… }
-
Can you show the code your are actually using to setup the database ?
The output you show does not present any error quite the contrary.
-
this->app_conn = QSqlDatabase(); this->app_conn.addDatabase(this->db_type); this->app_conn.setDatabaseName(this->db_name); this->app_conn.setHostName(this->db_host); this->app_conn.setPort(this->db_port); this->app_conn.setUserName(this->user_name); this->app_conn.setPassword(this->user_password);
this->db_type is "QPSQL".
-
You are using QSqlDatabase in the wrong manner.
addDatabase
is a static member, you are manipulating an invalid object.As the QSqlDatabase warns about: do not store local variables of that type. The class already provides everything needed to handle the objects you create from it.
-
-
So is it necessary to grab all "Debug" DLLs and place them to "Release"? How to avoid this crutch?
-
What debug dll ?
-
\sqldrivers\qsqlpsql.dll \platforms\qwindows.dll \vcruntime140.dll \Qt5Sql.dll \Qt5Core.dll \msvcrt.dll \libstdc++-6.dll \libssl-1_1-x64.dll \libpq.dll \libintl-8.dll \libiconv-2.dll \libcrypto-1_1-x64.dll
-
Ah, you meant the content of the Debug folder.
One thing you can do is go in the Run part of the Project panel and modify the PATH environment variable to include the path to these dlls.
-
@SGaist
I've made additional folder inside my project and move all DLLs into it. After that add path to this folder in PATH variable. It works but this method is crutch anyway…