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
    #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
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #34

                      On Windows there's two way to find .dlls:

                      • they are in the same folder
                      • they are in a folder in your PATH environment variable

                      Qt Creator does the change for Qt for you based on which kit you are using. Since you use external dependencies, it's up to you to provide a mean to find your dependencies dlls. And no, modifying your system's PATH environment is not the correct way.

                      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

                        @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 Offline
                        B Offline
                        Bonnie
                        wrote on last edited by Bonnie
                        #35

                        @alxdef
                        Why?
                        On windows the most usual way is just putting the dependency dlls with the exe, famous software products also do like that.

                        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