hi,
I have trouble conneting to PostgreSQL database. With installed newest QTSDK I am working on linux platform with qt creator.
This is my code:
Code:
#include <QtGui/QApplication> #include <QSqlDatabase> #include <QMessageBox> int main(int argc, char *argv[]) { db.setDatabaseName("name"); db.setPassword("pass"); db.setHostName("localhost"); db.setUserName("user"); if (!db.open()) { qApp->tr("Unable to establish a database connection.\n")); return false; } return a.exec(); }
I have added sql module in .pro file.
Connection isn't established.
Is it possible that there is problem with driver, because I read that this driver is supported in QT?
Could you help me?
Thanks
Added after 15 minutes:
Don't bother, I found the problem. It was connected to postgre configuration files.