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. QPSQL driver not loaded
Forum Updated to NodeBB v4.3 + New Features

QPSQL driver not loaded

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 552 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.
  • O Offline
    O Offline
    OniFloppa
    wrote on last edited by
    #1

    Hello , I have been ramming my head against the for some hours.
    I created a simple database with a QPSQL driver , however , I get this:

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

    I have the 4 files regarding psql in plugins section of the MSVC2019 compiler:
    qsqlpsql.dll
    qsqlpsql.pdb
    qsqlpsqld.dll
    qsqlpsqdl.dpd

    so I don't think there is a problem here.

    Saw a post from 2014 and a Youtube tutorial on this , a they had a .pro file in C:\Qt\6.6.1\Src\qtbase\src\plugins\sqldrivers\psql , which I don't. Which is used to build the driver.

    I used this https://doc.qt.io/qt-6/sql-driver.html , and I guess the commands should be run in C:\Qt\6.6.1\Src , however , they don't work.

    Added to PATH enviroment variable:
    C:\Program Files\PostgreSQL\16\bin
    C:\Program Files\PostgreSQL\16\lib
    as this brother said
    https://www.qtcentre.org/threads/59024-Building-Postgresql-driver

    Please help , I have tried much and it still doesn't work. Saw a post that said to reintall qt as a whole , and when it sees PostgreSql on my PC , it will do the things I need to do automatically. I consider this as a final option.

    piervalliP 1 Reply Last reply
    0
    • O OniFloppa

      Hello , I have been ramming my head against the for some hours.
      I created a simple database with a QPSQL driver , however , I get this:

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

      I have the 4 files regarding psql in plugins section of the MSVC2019 compiler:
      qsqlpsql.dll
      qsqlpsql.pdb
      qsqlpsqld.dll
      qsqlpsqdl.dpd

      so I don't think there is a problem here.

      Saw a post from 2014 and a Youtube tutorial on this , a they had a .pro file in C:\Qt\6.6.1\Src\qtbase\src\plugins\sqldrivers\psql , which I don't. Which is used to build the driver.

      I used this https://doc.qt.io/qt-6/sql-driver.html , and I guess the commands should be run in C:\Qt\6.6.1\Src , however , they don't work.

      Added to PATH enviroment variable:
      C:\Program Files\PostgreSQL\16\bin
      C:\Program Files\PostgreSQL\16\lib
      as this brother said
      https://www.qtcentre.org/threads/59024-Building-Postgresql-driver

      Please help , I have tried much and it still doesn't work. Saw a post that said to reintall qt as a whole , and when it sees PostgreSql on my PC , it will do the things I need to do automatically. I consider this as a final option.

      piervalliP Offline
      piervalliP Offline
      piervalli
      wrote on last edited by piervalli
      #2

      @OniFloppa
      Do you have the message when run the project on Qt creator or when do you distribute it?
      Copy the DLL of bin folder in the executable of your project. All are not necessary, but it is an easy way to test.

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

        Hi and welcome to devnet,

        Start your application with the QT_DEBUG_PLUGINS environment variable set to 1. That will dump the plugin information and you should see why it's not getting loaded.

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

        O 1 Reply Last reply
        2
        • SGaistS SGaist

          Hi and welcome to devnet,

          Start your application with the QT_DEBUG_PLUGINS environment variable set to 1. That will dump the plugin information and you should see why it's not getting loaded.

          O Offline
          O Offline
          OniFloppa
          wrote on last edited by
          #4

          @SGaist So the last thing I tried was :

          @OniFloppa said in QPSQL driver not loaded:

          Added to PATH enviroment variable:
          C:\Program Files\PostgreSQL\16\bin
          C:\Program Files\PostgreSQL\16\lib

          It didn't work , made this post , and went to bed. I was about to implement what you said , but I think the last step was to restart Qt Creator , because it works now! Thanks for the response anyway.

          JonBJ 1 Reply Last reply
          0
          • O OniFloppa has marked this topic as solved on
          • O OniFloppa

            @SGaist So the last thing I tried was :

            @OniFloppa said in QPSQL driver not loaded:

            Added to PATH enviroment variable:
            C:\Program Files\PostgreSQL\16\bin
            C:\Program Files\PostgreSQL\16\lib

            It didn't work , made this post , and went to bed. I was about to implement what you said , but I think the last step was to restart Qt Creator , because it works now! Thanks for the response anyway.

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #5

            @OniFloppa Some programs only work on certain days (especially under Windows).... ;)

            1 Reply Last reply
            1

            • Login

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