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. sqldrivers: PostgreSQL not found (Win10, Qt5.11.2, MSVC2017, Postgres 9.6 and 11)

sqldrivers: PostgreSQL not found (Win10, Qt5.11.2, MSVC2017, Postgres 9.6 and 11)

Scheduled Pinned Locked Moved Solved General and Desktop
postgresqlsqldrivermsvc2017
7 Posts 2 Posters 1.8k 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.
  • R Offline
    R Offline
    robro
    wrote on 27 Oct 2018, 09:00 last edited by
    #1

    Hello,

    I would like to use the native PostgreSQL driver in Qt.

    My system is:
    Win 10 x64
    Qt5.11.2
    MSVC2017 x64
    PostgresSQL 9.6, PostgreSQL 11, both installed with the EnterpriseDB installer in the x64 version

    In general, I would like to use PostgreSQL 11, but as I could not manage to build the driver I thought it might be because of the version and tried it with 9.6 too.
    Sadly it also failed.

    What did I do:

    cd C:\Qt2\5.11.2\Src\qtbase\src\plugins\sqldrivers //Navigate to driver folder
    C:\Qt2\5.11.2\msvc2017_64\bin\qmake “INCLUDEPATH+=C:/Program Files/PostgreSQL/9.6/include” “LIBS+=C:/Program Files/PostgreSQL/9.6/lib/libpq.lib” sqldrivers.pro //Run QMake
    //Result: PostgreSQL is not detected
    

    I was not sure whether I should use "/" or "\" for the "INCLUDEPATH" and the "LIBS".
    So I tried both and nothing changed.
    PostgreSQL is not detected.

    I have no clue with which compiler PostgreSQL was built, but if I understood the documentation right it was MSVC x64.
    The version I do not know.
    So do I need to build PostgreSQL myself?

    It also seems that others have the same problem:
    Another Thread

    Sadly the thread is unsolved and I could not find a solution for me.

    I would be really nice if you could help me.

    Thank you very much!

    1 Reply Last reply
    0
    • C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 27 Oct 2018, 10:23 last edited by
      #2

      Try to move the include and libs path to another folder without spaces.

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

      R 1 Reply Last reply 27 Oct 2018, 11:20
      1
      • C Christian Ehrlicher
        27 Oct 2018, 10:23

        Try to move the include and libs path to another folder without spaces.

        R Offline
        R Offline
        robro
        wrote on 27 Oct 2018, 11:20 last edited by
        #3

        @Christian-Ehrlicher said in sqldrivers: PostgreSQL not found (Win10, Qt5.11.2, MSVC2017, Postgres 9.6 and 11):

        Try to move the include and libs path to another folder without spaces.

        I tried it for both versions and is still not recognizing PostgreSQL.

        1 Reply Last reply
        0
        • C Online
          C Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 27 Oct 2018, 13:51 last edited by
          #4

          According to the documentation you pass the wrong parameters to qmake: http://doc.qt.io/qt-5/sql-driver.html#qpsql

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

          R 1 Reply Last reply 27 Oct 2018, 16:22
          2
          • C Christian Ehrlicher
            27 Oct 2018, 13:51

            According to the documentation you pass the wrong parameters to qmake: http://doc.qt.io/qt-5/sql-driver.html#qpsql

            R Offline
            R Offline
            robro
            wrote on 27 Oct 2018, 16:22 last edited by
            #5

            @Christian-Ehrlicher said in sqldrivers: PostgreSQL not found (Win10, Qt5.11.2, MSVC2017, Postgres 9.6 and 11):

            According to the documentation you pass the wrong parameters to qmake: http://doc.qt.io/qt-5/sql-driver.html#qpsql

            You are right.
            I found the wrong arguments somewhere else.

            psql is included in the source code of PostgreSQL.
            So it seems to be necessary to download the source code.
            The lib folder namend in the documentation is not there.
            I assume I would need to build PostgreSQL myself to generate it.

            In between I got the ODBC-Connector working.
            So I think it is easier using that one than compiling PostgreSQL from source.
            This is what I will do now.

            Thanks for the help :-)

            1 Reply Last reply
            1
            • C Online
              C Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 27 Oct 2018, 16:39 last edited by
              #6

              You don't need to build postgresql by yourself. The lib and include folder should be there when you install psql server - maybe you forgot to install the devel packages (don't remember what I really installed in postgres) or sth. similar.

              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
              2
              • R Offline
                R Offline
                robro
                wrote on 27 Oct 2018, 17:48 last edited by
                #7

                Thanks,

                I tried it without success.

                For me it seems the documentation is not up to date as the named folder sturcture is not existing in the EnterpriseDB installer installed version or in the official sources.

                I also looked whether there is something like an extra psql module to download, but have not found anything.

                1 Reply Last reply
                0

                3/7

                27 Oct 2018, 11:20

                • Login

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