QSqlDatabase: QPSQL driver not loaded

  • My setup :

    OS-RHEL 6.1
    QT-Qt Creator 2.4.1
    Based on Qt 4.7.4 (32 bit) installed in /home/CPSS/QtSDK/QtCreator
    Database-Postgres pluse Advanced Server 9.0 installed in \opt\PostgresPlus\9.0AS

    My program:
    dbps.pro file
    QT += core gui
    QT += sql
    TARGET = dbps
    TEMPLATE = app
    SOURCES += main.cpp
    HEADERS += mainwindow.h
    FORMS += mainwindow.ui

    @#include "mainwindow.h"
    #include "ui_mainwindow.h"
    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)
    QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
    if (!db.open())
    qDebug("Database Opening failled\n");
    qDebug("Database Opened\n");

    delete ui;

    My problem:

    when i am running this program ,error comes like this..

    Starting /home/CPSS/Documents/dbps/dbps...
    QSqlDatabase: QPSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE
    Database Opening failled
    /home/CPSS/Documents/dbps/dbps exited with code 0
    I saw qt SQL driver documentation http://doc.qt.nokia.com/4.7-snapshot/sql-driver.html
    and try to solve this problem..

    [CPSS@localhost sqldrivers]$ qmake "INCLUDEPATH+=\opt\PostgresPlus\9.0AS\include" "LIBS+=-L\opt\PostgresPlus\9.0AS\lib -lpq" psql.pro
    Error processing project file: /home/CPSS/QtSDK/QtCreator/lib/qtcreator/plugins/sqldrivers/psql.pro
    As there is no psql folder in my computer so try to do it in sqldrivers folder...then also i face problem as before

    I copied libqsqlpsql.so file in /home/CPSS/QtSDK/QtCreator/lib/qtcreator/plugins/sqldrivers but problem is still there..

    please help me to solve this problem...

    Edit: please use @ tags around code sections; Andre

  • Set the QT_DEBUG_PLUGINS environment variable (to 1), and re-run. It should give you more info on what is going on with the loading of plugins.

    See "this video":/videos/watch/the-last-mile-effective-debugging-and-profiling-for-qt-and-qt-quick for more details on debug techniques with Qt.

Log in to reply

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