How to build QPSQL driver using CMake for MSVC 2019 64
-
Hi everyone,
I'm newbie just start to use qt6 and I'm having a problem with my qt application (using msvc2019_64 kit) when trying to connect to PostgreSQL database.
I've met the error said "QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QPSQL"I have read some topic about this problem and get some advice that I should build QPSQL driver. But I have checked the Qt\6.3.0\src\qtbase\src\plugins\sqldrivers\psql folder and only find the CMakeList.txt instead of .pro files for using qmake.

I would be really appreciate if someone could give me an instruction of building the QPSQL driver as above for the msvc2019_64 kit. And does the "QPSQL driver not loaded" will be fixed after building this driver?
Thank you very much for your concern.
-
Hi everyone,
I'm newbie just start to use qt6 and I'm having a problem with my qt application (using msvc2019_64 kit) when trying to connect to PostgreSQL database.
I've met the error said "QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QPSQL"I have read some topic about this problem and get some advice that I should build QPSQL driver. But I have checked the Qt\6.3.0\src\qtbase\src\plugins\sqldrivers\psql folder and only find the CMakeList.txt instead of .pro files for using qmake.

I would be really appreciate if someone could give me an instruction of building the QPSQL driver as above for the msvc2019_64 kit. And does the "QPSQL driver not loaded" will be fixed after building this driver?
Thank you very much for your concern.
@thanhbk said in How to build QPSQL driver using CMake for MSVC 2019 64:
QSqlDatabase: available drivers: QSQLITE QODBC QPSQL"
This means the driver is already there but is missing some dependencies. Make sure the needed postgresql libs are in the PATH (e.g. with Dependency Walker)
-
@thanhbk said in How to build QPSQL driver using CMake for MSVC 2019 64:
QSqlDatabase: available drivers: QSQLITE QODBC QPSQL"
This means the driver is already there but is missing some dependencies. Make sure the needed postgresql libs are in the PATH (e.g. with Dependency Walker)
@Christian-Ehrlicher said in How to build QPSQL driver using CMake for MSVC 2019 64:
Make sure the needed postgresql libs are in the PATH (e.g. with Dependency Walker)
Hi Christian-Ehrlicher, thank you very much for your answer but could you show me how to set PATH for the needed postgresql libs and which postgresql libs are needed?
-
@Christian-Ehrlicher said in How to build QPSQL driver using CMake for MSVC 2019 64:
Make sure the needed postgresql libs are in the PATH (e.g. with Dependency Walker)
Hi Christian-Ehrlicher, thank you very much for your answer but could you show me how to set PATH for the needed postgresql libs and which postgresql libs are needed?
@thanhbk said in How to build QPSQL driver using CMake for MSVC 2019 64:
but could you show me how to set PATH for the needed postgresql libs and which postgresql libs are needed?
https://www.google.com/search?client=firefox-b-d&q=wndows+set+PATH
Dependency Walker or it's successor Dependencies
-
@thanhbk said in How to build QPSQL driver using CMake for MSVC 2019 64:
but could you show me how to set PATH for the needed postgresql libs and which postgresql libs are needed?
https://www.google.com/search?client=firefox-b-d&q=wndows+set+PATH
Dependency Walker or it's successor Dependencies
Hi @Christian-Ehrlicher
Thank you for your respone. Sorry for my lack of knowledgeI have set PATH for the sqldrivers and PostgreSQL as the picture

After setting the PATH, the error "QPSQL driver not loaded" is still show up. Am I missing anythings?And I just run through the Denpendency Walker for qsqlpsql.dll and seems like it's missing some dlls but I don't know how to fix it. Could you help me with it?

-
Hi @Christian-Ehrlicher
Thank you for your respone. Sorry for my lack of knowledgeI have set PATH for the sqldrivers and PostgreSQL as the picture

After setting the PATH, the error "QPSQL driver not loaded" is still show up. Am I missing anythings?And I just run through the Denpendency Walker for qsqlpsql.dll and seems like it's missing some dlls but I don't know how to fix it. Could you help me with it?

Hi,
Check the your environment variables in the Run part of the Project panel. To be sure that the changes have propagated there.
-
Hi,
I have set the Path again for postgresql libs and the problem is solved.
Thank you very much for all of your suggestion.You're welcome !
Since you thing working now, please mark the thread as solved using the "Topic Tools" button or the three doted menu beside the answer you deem correct so that other forum users may know a solution has been found :-)