Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to build QPSQL driver using CMake for MSVC 2019 64
Forum Updated to NodeBB v4.3 + New Features

How to build QPSQL driver using CMake for MSVC 2019 64

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 891 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thanhbk
    wrote on last edited by
    #1

    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.

    c59d4632-8691-48b0-a423-7508f6622a50-image.png

    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.

    Christian EhrlicherC 1 Reply Last reply
    0
    • T thanhbk

      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.

      c59d4632-8691-48b0-a423-7508f6622a50-image.png

      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.

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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)

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      T 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        @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)

        T Offline
        T Offline
        thanhbk
        wrote on last edited by
        #3

        @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 EhrlicherC 1 Reply Last reply
        0
        • T thanhbk

          @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 EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          T 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @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

            T Offline
            T Offline
            thanhbk
            wrote on last edited by
            #5

            Hi @Christian-Ehrlicher
            Thank you for your respone. Sorry for my lack of knowledge

            I have set PATH for the sqldrivers and PostgreSQL as the picture 37985e61-2617-4b40-9643-c4a85a0cb141-image.png
            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? 2b857d74-6d74-48a4-915c-36c67992e7fc-image.png

            SGaistS 1 Reply Last reply
            0
            • T thanhbk

              Hi @Christian-Ehrlicher
              Thank you for your respone. Sorry for my lack of knowledge

              I have set PATH for the sqldrivers and PostgreSQL as the picture 37985e61-2617-4b40-9643-c4a85a0cb141-image.png
              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? 2b857d74-6d74-48a4-915c-36c67992e7fc-image.png

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              Check the your environment variables in the Run part of the Project panel. To be sure that the changes have propagated there.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • T Offline
                T Offline
                thanhbk
                wrote on last edited by
                #7

                Hi,
                I have set the Path again for postgresql libs and the problem is solved.
                Thank you very much for all of your suggestion.

                SGaistS 1 Reply Last reply
                0
                • T thanhbk

                  Hi,
                  I have set the Path again for postgresql libs and the problem is solved.
                  Thank you very much for all of your suggestion.

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  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 :-)

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved