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. Postgresql driver is not found
Forum Updated to NodeBB v4.3 + New Features

Postgresql driver is not found

Scheduled Pinned Locked Moved Unsolved General and Desktop
35 Posts 5 Posters 3.9k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #14

    Then run Dependency Walker on these.
    The next likely candidate is the VC runtime dll.

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

    A 1 Reply Last reply
    0
    • SGaistS SGaist

      Then run Dependency Walker on these.
      The next likely candidate is the VC runtime dll.

      A Offline
      A Offline
      alxdef
      wrote on last edited by
      #15

      @SGaist
      8312aaa0-8559-414d-af11-2e88661267da-изображение.png
      I think that library is not in business.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #16

        I meant that you should run Dependency Walker on the OpenSSL dlls and that it would have likely been the VC runtime missing.

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

        A 1 Reply Last reply
        0
        • SGaistS SGaist

          I meant that you should run Dependency Walker on the OpenSSL dlls and that it would have likely been the VC runtime missing.

          A Offline
          A Offline
          alxdef
          wrote on last edited by
          #17

          @SGaist

          1c6655d5-a634-4197-bd37-83ae354f1564-изображение.png

          It looks like infinite loop…

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by SGaist
            #18

            Did you copy the VC runtime in the same folder as the OpenSSL library ?

            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
            • A alxdef

              @JonB

              Here DW output:
              523d9a1d-5b18-4de3-a968-ce6003d55478-изображение.png
              But DW fault with this:
              f01e8bb5-f5ae-46e2-877c-35214a135f8b-изображение.png

              1. I tried to add paths to Postgres "bin" and "lib" folders - no way.
              2. Copy DLLs to different folders: "build", "plugins\build" and other variations - no luck.
              3. I didn't build database libraries myself.
              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #19

              @alxdef Your first screenshot tells you that libstdc++-6.dll is missing.

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

              SGaistS A 2 Replies Last reply
              1
              • Christian EhrlicherC Christian Ehrlicher

                @alxdef Your first screenshot tells you that libstdc++-6.dll is missing.

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

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

                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
                • Christian EhrlicherC Christian Ehrlicher

                  @alxdef Your first screenshot tells you that libstdc++-6.dll is missing.

                  A Offline
                  A Offline
                  alxdef
                  wrote on last edited by
                  #21

                  @Christian-Ehrlicher

                  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
                  
                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    alxdef
                    wrote on last edited by
                    #22

                    So there are no ideas…

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      Bonnie
                      wrote on last edited by Bonnie
                      #23

                      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 on libiconv-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 be some many "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.

                      A 1 Reply Last reply
                      2
                      • B Bonnie

                        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 on libiconv-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 be some many "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.

                        A Offline
                        A Offline
                        alxdef
                        wrote on last edited by
                        #24

                        @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())
                        {
                          //…
                        }
                        
                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #25

                          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.

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

                          A 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            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.

                            A Offline
                            A Offline
                            alxdef
                            wrote on last edited by
                            #26

                            @SGaist

                            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".

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #27

                              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.

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

                              A 1 Reply Last reply
                              2
                              • SGaistS SGaist

                                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.

                                A Offline
                                A Offline
                                alxdef
                                wrote on last edited by
                                #28

                                @SGaist said in Postgresql driver is not found:

                                QSqlDatabase

                                Many thanks! Connected Ok.

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  alxdef
                                  wrote on last edited by alxdef
                                  #29

                                  So is it necessary to grab all "Debug" DLLs and place them to "Release"? How to avoid this crutch?

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #30

                                    What debug dll ?

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

                                    A 1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      What debug dll ?

                                      A Offline
                                      A Offline
                                      alxdef
                                      wrote on last edited by
                                      #31

                                      @SGaist

                                      \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
                                      
                                      1 Reply Last reply
                                      0
                                      • SGaistS Offline
                                        SGaistS Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #32

                                        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.

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

                                        A 1 Reply Last reply
                                        0
                                        • SGaistS SGaist

                                          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.

                                          A Offline
                                          A Offline
                                          alxdef
                                          wrote on last edited by alxdef
                                          #33

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

                                          B 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