QPSQL driver not loaded



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


  • Lifetime Qt Champion

    Hi,

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



  • Which library excatly? The qsqlpsql.dll?


  • Lifetime Qt Champion

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



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


  • Lifetime Qt Champion

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



  • 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?


  • Lifetime Qt Champion

    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



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


  • Moderators

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



  • 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



  • 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



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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.