Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Deploy application in windows with driver of postgresql
QtWS25 Last Chance

Deploy application in windows with driver of postgresql

Scheduled Pinned Locked Moved Solved Installation and Deployment
12 Posts 4 Posters 1.7k Views
  • 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.
  • M Offline
    M Offline
    MarlonBM
    wrote on last edited by
    #1

    Hi,

    Everything works fine on my PC, I can connect to the postgresql driver.

    I have developed an application with c ++ and some files in qml, which connect to a postgresql database.
    I have compiled my executable with mingw73_64, which is what brings the installation of Qt 5.12.1.
    From my PC, I have tried to connect to a database that is regardless of the architecture, that is, I connect to a 32-bit postgresql 9.2 database, and a 64-bit postgresql 11 database, and everything works.
    When I try to deploy my application to be used on other PCs, I use this:

    windeployqt --qmldir <path-to-app-qml-files> <path-to-app-binary>

    which is how it comes in the description of my qt. This generates all the dll associated with my application, but those of postgres are missing, so I have copied the following libraries found in the postgres installation:

    for 64 bit
    libeay32.dll
    libiconv-2.dll
    libintl-9.dll
    libpq.dll
    libxml2.dll
    libxslt.dll
    ssleay32.dll
    zlib1.dll

    or for 32 bit, in case I connect to the 32 bit postgres database
    libeay32.dll
    libintl.dll
    libpq.dll
    ssleay32.dll

    When I try to put these files on another PC, I get a driver not loaded error.

    and I have the postgres dll files mentioned, I have the sqldrivers folder with its qsqlpsql.dll dll, but it doesn't work for me.

    I tried with different dll but I don't get it.
    I tried to create my own library as it says in the version of qt

    cd% QTDIR% \ qtbase \ src \ plugins \ sqldrivers
    qmake - "PSQL_INCDIR = C: \ Program Files \ PostgreSQL \ 11 \ include" PSQL_LIBDIR = "C: \ Program Files \ PostgreSQL \ 11 \ lib \ ms"
    nmake sub-psql

    but when doing the qmake from the console of Qt 5.12.1 (MinGW7.3.0 64 bit)

    I am shown a list of the sql drivers but only those of SQLITE and ODBC are activated, but that of postgresql is not.

    What could be the problem that does not connect on other PCs, and on mine if it connects?

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Use Dependency Walker or similar to find out what the Qt postgres plugin really needs.

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

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

        Hi,

        Beside the good advice from @Christian-Ehrlicher, check also the PostgreSQL libraries dependencies.

        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
        1
        • M Offline
          M Offline
          MarlonBM
          wrote on last edited by
          #4

          It is possible that the qpsql library tells me that it depends on a libpq.dll that is not the one inside the application folder?

          Screenshot_1.png

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

            Maybe a question of the architecture of the dll you copied.

            By the way, unless you added the folder containing the .dll in the search path of Dependency Walker, it will not find it because the plugin is in a different folder.

            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
            3
            • M Offline
              M Offline
              MarlonBM
              wrote on last edited by
              #6

              Before to update this programn, its work Fine with dlls of postgresql for 32 bit. This change could be the problem when i try to compile my programn, but this time with 64 bit?

              jsulmJ 1 Reply Last reply
              0
              • M MarlonBM

                Before to update this programn, its work Fine with dlls of postgresql for 32 bit. This change could be the problem when i try to compile my programn, but this time with 64 bit?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @MarlonBM You can't mix 32bit and 64bit in same application.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                2
                • M Offline
                  M Offline
                  MarlonBM
                  wrote on last edited by
                  #8

                  I get it.
                  But the version of Qt 5.12.1 comes for 64 bit, and what it has done is compile everything to 64bit, with windeploy it takes all 64 bit dll.
                  The application works for me, it starts, but the first thing I have is a login form, and when I try to use it, it gives me the driver not loaded error. That is why I think it is the postgres libraries that should be giving me problems.

                  jsulmJ 1 Reply Last reply
                  0
                  • M MarlonBM

                    I get it.
                    But the version of Qt 5.12.1 comes for 64 bit, and what it has done is compile everything to 64bit, with windeploy it takes all 64 bit dll.
                    The application works for me, it starts, but the first thing I have is a login form, and when I try to use it, it gives me the driver not loaded error. That is why I think it is the postgres libraries that should be giving me problems.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @MarlonBM You need 64bit PostgreSQL dll.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      MarlonBM
                      wrote on last edited by
                      #10

                      on the pc that I have the database,
                      I have 2 versions of postgres installed, 9.2 of 32 bit, and 11 of 64 bit. I have stopped the postgresql service of the 32-bit one, in case they conflict. I have copied the dll that are in the bin folder of version 11 of 64 bit postgres, for my program folder and it still gives me the same error of
                      "Driver not load"

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

                        Again: are you sure that the correct dependencies are 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
                        • M Offline
                          M Offline
                          MarlonBM
                          wrote on last edited by
                          #12

                          Hello,
                          I have solved with the dependency walker tool,
                          as advised by @Christian Ehrlicher and @SGaist.
                          It was not a problem of the postgres dll but it was necessary to install mvcredistx64.

                          1 Reply Last reply
                          2

                          • Login

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