[SOLVED] - new old discution - QSqlDatabase: QPSQL driver not loaded



  • Hi,

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

    My system: Windows 7, Qt 5.4 installed recently, previous Qt 5.2; Postgresql 9.4 installed recently, previous Postgresql 9.3

    I had Qt 5.2 installed with Postgresql 9.3, everything worked OK. after upgrading to Qt 5.4 and Postgresql 9.4, I got this error while opening the same application.

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

    the application didn't change.
    Any idea what could be?
    thank you.


  • Lifetime Qt Champion

    Hi,

    did you check your PATH environment variable (the one in the Run part of the Project panel ? It might be still containing the path to your old PostgreSQL.



  • Hi,
    thanks for your feedback.
    The PATH variable mentions the
    "C:\Qt\Qt5.4.0\5.4\mingw491_32\lib"
    path, which corresponds to the Qt 5.4 directory. Nowhere in the settings the old Qt 5.2 folder is mentioned.

    what am I doing wrong?
    thank you.


  • Lifetime Qt Champion

    I meant the PostgreSQL folder



  • the PostgreSql\bin\lib folder was missing from the PATH variable.
    problem solved.
    Any idea why this folder wasn't mentioned?
    thank you.


  • Lifetime Qt Champion

    Good question, on Windows it's always a bit complicated. As for deployment, every dll you need should be accessible by your application, so you either need to have them in a folder in the PATH environment variable or have them in the same folder as your application. But it's also a bad idea to have every paths in your PATH variable since you could have several applications using dlls from the same library but at different versions thus there's the risk of breaking one of them. That's why Qt Creator modifies the PATH variable when you run your application so you have an isolated scope to work with.


Log in to reply
 

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