PDA

View Full Version : QSqlDatabase: QPSQL driver not loaded



mistu
18th September 2012, 10:54
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\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtSql>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
if (!db.open())
{
qDebug("Database Opening failled\n");
}
else
{
qDebug("Database Opened\n");
}
}
MainWindow::~MainWindow()
{

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

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...