Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Solved QPSQL driver not loaded

    Installation and Deployment
    6
    14
    21572
    Loading More Posts
    • 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.
    • Vinorcola
      Vinorcola last edited by

      Hello every body.

      Since I can't build the MySQL driver, I try to make a connection to PostgreSQL database like I saw the QPSQL driver was available. But when I want to connect, I have got the message "QPSQL driver not loaded". I check in the directory C:\Qt\5.1.1\mingw48_32\plugins\sqldrivers and I have the good DLL : qsqlpsql.dll and qsqlpsqld.dll.

      So why is the driver not loaded? What have we have to do?

      Thanks.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Do you have the postgresql dll in your PATH environment variable ?

        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 Reply Quote 0
        • Vinorcola
          Vinorcola last edited by

          Which library excatly? The qsqlpsql.dll?

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            No, the dll from your PostgreSQL installation (pq.dll IIRC)

            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 Reply Quote 0
            • Vinorcola
              Vinorcola last edited by

              I don't find any dll of this kind. I tried to copy evry dll in the postgreSQL folder into my application folder. But it didn't work neither.

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                You can use Dependency Walker on your qsqlpsql.dll to check what dlls you need.

                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 Reply Quote 0
                • Vinorcola
                  Vinorcola last edited by

                  I have got the message:
                  Error: At least one required implicit or forwarded dependency was not found.
                  Warning: At least one delay-load dependency module was not found.
                  Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

                  There is few missing dll:
                  LIBPQ.DLL
                  API-MS-WIN-CORE-COM-L1-1-0.DLL
                  API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
                  API-MS-WIN-CORE-WINRT-L1-1-0.DLL
                  API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
                  API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
                  API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL
                  DCOMP.DLL
                  IESHIMS.DLL

                  But where can I find all this dll?

                  1 Reply Last reply Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    You can safely ignore DCOMP and IESHIMS.
                    The API* should also not be of concern.

                    So you need to have LIBPQ.dll in your PATH.

                    What you can do is to go in the Projects pane of QtCreator, choose Run for your Kit and edit the PATH variable in "Run Environment", add the complete path to where libpq.dll can be located in front of the other paths (don't forget the semi-colon at the end of your path)
                    Then you should be good to go

                    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 Reply Quote 0
                    • Vinorcola
                      Vinorcola last edited by

                      I add the "C:\Program Files\PostgreSQL\9.3\bin" directory into the Windows PATH environment variable (and restart the computer) but it doesn't work. I still have the message "Driver not loaded".

                      I check back with depends.exe, and LIBPQ.DLL is not missing anymore.
                      But it display me the warning dialog saying:

                      Errors were detected when processing "c:\qt\mingw48_32\plugins\sqldrivers\QSQLPSQL.DLL". See the log wondow for details.

                      I still have the missing dependancy as before (except for LIBPQ.DLL)

                      1 Reply Last reply Reply Quote 0
                      • p3c0
                        p3c0 Moderators last edited by

                        There are some more Dll's on which libpq depends. I guess these are
                        libssl32.dll
                        libeay32.dll
                        ssleay32.dll

                        157

                        1 Reply Last reply Reply Quote 0
                        • batman.890825
                          batman.890825 last edited by SGaist

                          I had the same problem but I just found the solution.
                          First I'm putting my environment conditions:

                          • Windows 8.1 Enterprise
                          • Qt 5.4
                          • PostgreSQL 8.4.22

                          Here is what I did:

                          1. I downloaded the PostgreSQL from http://olex.openlogic.com/packages/postgresql/8.4.22-1
                          2. I followed the instructions from this video https://www.youtube.com/watch?v=fBgJ9Azm_S0
                          3. I used the 2nd method, which is creating the dll by myself but in my case I didn't had to add the DEFINES += HAVE_STRUCT_TIMESPEC. It seems to me that's for the PostgreSQL 9.X
                          4. After I moved the new dlls I still had the same problem, but when read this post I put in the PATH var this two dir "C:\PostgreSQL\8.4\bin; C:\Qt\Qt5.4.0\5.4\mingw491_32\bin" and reboot it and voila problem solved

                          I hope this will also help you

                          1 Reply Last reply Reply Quote 0
                          • batman.890825
                            batman.890825 last edited by SGaist

                            I had the same problem but I just found the solution.
                            First I'm putting my environment conditions:

                            • Windows 8.1 Enterprise
                            • Qt 5.4
                            • PostgreSQL 8.4.22

                            Here is what I did:

                            1. I downloaded the PostgreSQL from http://olex.openlogic.com/packages/postgresql/8.4.22-1
                            2. I followed the instructions from this video https://www.youtube.com/watch?v=fBgJ9Azm_S0
                            3. I used the 2nd method, which is creating the dll by myself but in my case I didn't had to add the DEFINES += HAVE_STRUCT_TIMESPEC. It seems to me that's for the PostgreSQL 9.X
                            4. After I moved the new dlls I still had the same problem, but when read this post I put in the PATH var this two dir "C:\PostgreSQL\8.4\bin; C:\Qt\Qt5.4.0\5.4\mingw491_32\bin" and reboot it and voila problem solved

                            I hope this will also help you

                            1 Reply Last reply Reply Quote 0
                            • F
                              Fenigor last edited by

                              Hi i just wanted to post an answer that I found that worked for me so that people in the future don't have to deal as much on it as me on Windows,
                              With Qt Creator version 5,4, Compiler: MinGW 4.9.1 32bits and Database: PostgreSQL 9.4 on Windows 8.1 32bit and Windows 7 32bit.
                              Just copy "libeay32.dll" , "intl.dll" , "libpq.dll" , "ssleay32.dll"(if any of them are missing, add them) from the PostgreSQL's bin folder to Qt's bin (for me it looks like this: Qt\5.4\mingw491_32\bin).
                              Best of luck.

                              Nikhil Navare 1 Reply Last reply Reply Quote 2
                              • Nikhil Navare
                                Nikhil Navare @Fenigor last edited by

                                @Fenigor This worked for me right away. Vow. Thanks a lot.

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post