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. QSqlDatabase:QPSQL Driver not loaded Driver not loaded
Qt 6.11 is out! See what's new in the release blog

QSqlDatabase:QPSQL Driver not loaded Driver not loaded

Scheduled Pinned Locked Moved Solved General and Desktop
26 Posts 5 Posters 10.4k Views 2 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.
  • jsulmJ jsulm

    @ram070787 I don't know how Debian/Ubuntu packages this stuff. You can search for them on your system, not sure which one is used by Qt (the C or C++ one, see https://wiki.postgresql.org/wiki/Client_Libraries).

    R Offline
    R Offline
    ram070787
    wrote on last edited by
    #10

    @jsulm I checked with another computer for the installed libraries regarding Postgresql. We both have same libraries installed (libpq5.so and other Postgresql librraies. ) It works will with him but not with me. And i think libpqxx packages are used by C++, so it may be used by Qt also.

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

      Hi and welcome to devnet,

      Did you install PostgreSQL development packages for your distribution ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 2 Replies Last reply
      1
      • SGaistS SGaist

        Hi and welcome to devnet,

        Did you install PostgreSQL development packages for your distribution ?

        R Offline
        R Offline
        ram070787
        wrote on last edited by
        #12

        @SGaist Yes I have installed "postgresql-dev" on my computer. Also this error below..
        QSqlDatabase: unknown driver not loaded

        QSqlDatabase: available drivers: QSQLITE QPSQL QPSQL7

        "\uFFFF:Driver not loaded Driver not loaded"

        I was able to recreate this error in another machine when I removed libqsqlpsql.so from the sqldriver folder in the Qt installtion and the error looked like

        QSqlDatabase: QPSQL driver not loaded

        QSqlDatabase: available drivers: QSQLITE QPSQL QPSQL7

        "\uFFFF:Driver not loaded Driver not loaded"

        I can understand this error. But mine shows "unknown".

        1 Reply Last reply
        0
        • R Offline
          R Offline
          ram070787
          wrote on last edited by ram070787
          #13

          I am working on codes written by other persons and have no idea how they did this . It seems to me that QSqldatabase is looking for "unknown driver" and is not able to load it. Is there any reason that this can happen?

          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi and welcome to devnet,

            Did you install PostgreSQL development packages for your distribution ?

            R Offline
            R Offline
            ram070787
            wrote on last edited by ram070787
            #14

            @SGaist These are my postgres packages installed

            1. postgresql/xenial-updates,xenial-updates,xenial-security,xenial- security,now 9.5+173ubuntu0.1 all [installed]
            2. postgresql-9.5/xenial-updates,xenial-security,now 9.5.12-0ubuntu0.16.04 amd64 [installed,automatic]
            3. postgresql-client-9.5/xenial-updates,xenial-security,now 9.5.12-0ubuntu0.16.04 amd64 [installed]
            4. postgresql-client-common/xenial-updates,xenial-updates,xenial-security,xenial-security,now 173ubuntu0.1 all [installed]
            5. postgresql-common/xenial-updates,xenial-updates,xenial-security,xenial-security,now 173ubuntu0.1 all [installed,automatic]
            6. postgresql-contrib-9.5/xenial-updates,xenial-security,now 9.5.12-0ubuntu0.16.04 amd64 [installed,automatic]

            I also have installed libpq5 and libpq-dev on my computer.

            jsulmJ 1 Reply Last reply
            0
            • R ram070787

              @SGaist These are my postgres packages installed

              1. postgresql/xenial-updates,xenial-updates,xenial-security,xenial- security,now 9.5+173ubuntu0.1 all [installed]
              2. postgresql-9.5/xenial-updates,xenial-security,now 9.5.12-0ubuntu0.16.04 amd64 [installed,automatic]
              3. postgresql-client-9.5/xenial-updates,xenial-security,now 9.5.12-0ubuntu0.16.04 amd64 [installed]
              4. postgresql-client-common/xenial-updates,xenial-updates,xenial-security,xenial-security,now 173ubuntu0.1 all [installed]
              5. postgresql-common/xenial-updates,xenial-updates,xenial-security,xenial-security,now 173ubuntu0.1 all [installed,automatic]
              6. postgresql-contrib-9.5/xenial-updates,xenial-security,now 9.5.12-0ubuntu0.16.04 amd64 [installed,automatic]

              I also have installed libpq5 and libpq-dev on my computer.

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

              @ram070787 What about libpqxx-dev ?

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

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

                There's something mighty fishy here.

                Did you install of Qt's development packages from your distribution ?
                What do you get if you run ldd on the PostgreSQL plugin ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                R 1 Reply Last reply
                0
                • SGaistS SGaist

                  There's something mighty fishy here.

                  Did you install of Qt's development packages from your distribution ?
                  What do you get if you run ldd on the PostgreSQL plugin ?

                  R Offline
                  R Offline
                  ram070787
                  wrote on last edited by
                  #17

                  @SGaist If I am right by Qt development package you mean the qtdeclarative5-dev packages. I had those installed.

                  I did not understand where this PostgreSQL plugin is? A "ldd psql" had all the dependencies.

                  1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @ram070787 What about libpqxx-dev ?

                    R Offline
                    R Offline
                    ram070787
                    wrote on last edited by
                    #18

                    @jsulm Yeah those were installed.

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      ram070787
                      wrote on last edited by
                      #19

                      I already spent a week trying to find the error and unsuccessful. so I have reinstalled my complete system. I will try to install all essential libraries and softwares and will come back here again. Thanks everyone for your help.

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        ram070787
                        wrote on last edited by ram070787
                        #20

                        Hi guys. I have found the reason for this. But not sure what to do about this. Maybe you guys are experienced in this.

                        My application runs by reading an .ini file in the folder "etc/myfile.ini" and automatically generates the same myfile.ini in my home folder with some details about my login credentials to the application that is built by Qt. The first run in my Qt opens my application and an .ini file is generated in my home folder. When I stop my application and restart it is gives "unknown driver error". So this .ini file is not generated again afresh. I have to delete the old .ini file in my home folder before running my application again.

                        Also my application gets a connection with the Sql database and the details about the database are written in the .ini file generated in my home folder. These details are written in another computer and not in mine.

                        1 Reply Last reply
                        0
                        • R Offline
                          R Offline
                          ram070787
                          wrote on last edited by
                          #21

                          Hi guys.. I found the reason for my failure in driver. It was a error within the project itself. The error seems a bit wierd initially but reinstalling showed me more about the error. The .ini file generation was having some problem and now I fixed it and it is all fine.. Thanks a lot for everyone..

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

                            Glad you found out and thanks for sharing !

                            Would you mind sharing what is in this ini file that wreaks such havoc in your application ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            R 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Glad you found out and thanks for sharing !

                              Would you mind sharing what is in this ini file that wreaks such havoc in your application ?

                              R Offline
                              R Offline
                              ram070787
                              wrote on last edited by
                              #23

                              @SGaist I am really sorry I cant share this .ini file with you.

                              But this .ini file has the database details (which driver should be used), server details that the application should connect to. I manually edited this file and made sure all the required paths are set and i was able to start my application in Qt and establish a connection to my database.

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

                                Thanks for the information !

                                Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been 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
                                  monfortpie
                                  wrote on last edited by
                                  #25

                                  Very curious the idea of a specific file ".ini" . I did'nt found a such file ".ini" in my project ....Bizarre....

                                  SGaistS 1 Reply Last reply
                                  0
                                  • M monfortpie

                                    Very curious the idea of a specific file ".ini" . I did'nt found a such file ".ini" in my project ....Bizarre....

                                    SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #26

                                    Hi and welcome to devnet,

                                    @monfortpie said in QSqlDatabase:QPSQL Driver not loaded Driver not loaded:

                                    Very curious the idea of a specific file ".ini" . I did'nt found a such file ".ini" in my project ....Bizarre....

                                    Because it's specific to how @ram070787 implemented its application, not something that is general.

                                    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

                                    • Login

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