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. 64 bit Windows QT QPSQL driver
Forum Updated to NodeBB v4.3 + New Features

64 bit Windows QT QPSQL driver

Scheduled Pinned Locked Moved Installation and Deployment
18 Posts 3 Posters 7.6k 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
    #2

    Hi,

    Which version of Qt are you using ?

    Do you have the PostgreSQL client library installed on your system ?

    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
    • S Offline
      S Offline
      sting
      wrote on last edited by
      #3

      I am using Qt 5.3.2

      I just found this and am giving it a go

      http://doc.qt.io/qt-5/sql-driver.html#qpsql.

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

        IIRC, Qt comes with the plugin built but you still need to first install the PostgreSQL client libraries.

        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
        • S Offline
          S Offline
          sting
          wrote on last edited by
          #5

          I have installed the libraries, when I try to open the database I get the messages.

          QSqlDatabase: QPSQL driver not loaded
          QSqlDatabase: available drivers: QSQLITE QODBC QODBC3

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

            What OS are you running ?

            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
            • S Offline
              S Offline
              sting
              wrote on last edited by
              #7

              Microsoft Windows 7

              1 Reply Last reply
              0
              • S Offline
                S Offline
                sting
                wrote on last edited by
                #8

                I am trying to build the driver with those instructions. I hate windows :(.

                When I run mingw32-make I am trying to pass in the path to the postgresql includes as -I C:\Progra~iles\PostgreSQL\9.4\include where the include the make is complaining about libpq-fe.h is sitting. the make script can't find it.

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

                  Don't use backslashes but forward and you should quote the path since it contains spaces

                  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
                  • S Offline
                    S Offline
                    sting
                    wrote on last edited by
                    #10

                    I have done the following from this reference

                    http://doc.qt.io/qt-5/sql-driver.html#qpsql.

                    cd %QTDIR%\src\plugins\sqldrivers\psql

                    qmake "INCLUDEPATH+=C:/PostgreSQL/9.4/include" "LIBS+=C:/PostgreSQL/9.4/lib/libpq.lib" psql.pro

                    when I run make I get the error

                    ld.exe cannot find -llibpq.lib

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

                      Hi,

                      Try again with

                      @"LIBS+=-LC:/PostgreSQL/9.4/lib -lpq"@

                      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
                      • S Offline
                        S Offline
                        sting
                        wrote on last edited by
                        #12

                        That worked, thank you very much. Now I can't load it. Do I need to use the QPluginLoader or is there a way to enable it in the environment. I tried

                        QPLUGIN += qsqlpsql

                        I set the environment variable Q_DEBUG_PLUGINS to 1 and I see all that is loaded, byt the psql plugin does not show up.

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

                          Go the Run part of the Project panel and check that the PATH environment variable contains the path to the folder containing your PostgreSQL dlls

                          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
                          • S Offline
                            S Offline
                            sting
                            wrote on last edited by
                            #14

                            Sorry it took me so long to reply, I have been home sick all week. I just got it to the point where it seems like it should work.

                            If I make the call

                            db = QSqlDatabase::addDatabase("QPSQL");

                            the message shows:

                            QSqlDatabase: QPSQL driver not loaded
                            QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

                            and the driver I am looking for seems to be in the list.

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

                              The driver is but your application also need to find the PostgreSQL dll(s) so the plugin can load

                              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
                              • S Offline
                                S Offline
                                student76
                                wrote on last edited by
                                #16

                                After 5 hours I'm obliged :) to give this contribution because otherwise it feels so wasted :). The reason, in my case, for above problem is that SSLEAY32.DLL and LIBEAY32.DLL dependency was MSVCR120.DLL which is part of the Visual studio 2013 redistributable with which Postgres for windows was built. Because those two files are dependencies of libpq.dll and libpq.dll is dependency of qsqlpsqld.dll hence the message.I downloaded and installed vcredist_x86.exe from http://www.microsoft.com/en-us/download/details.aspx?id=40784 and now it works. Although is maybe obious 32 bit version is needed, also great help was dependency walker, not at first but when I read 32 bit version of walker is needed everything was quite obvious.Hope it helps :)

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

                                  Hi,

                                  Thanks for sharing your findings !

                                  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
                                  • S Offline
                                    S Offline
                                    sting
                                    wrote on last edited by
                                    #18

                                    I have to apologize that I haven't been able to check any of this. I will be back in the office tomorrow and will see where this is. I thought I had the postgresql lib directory on my path, but I really don't remember. The problem may be the microsoft redistributables, if infact I have the libs on my path.

                                    I appreciate all of your help.

                                    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