This is the code for the connection:
bool createPostgreSQLConnection()
{
qDebug() << "--------------------";
qDebug() << "Postgree connection";
db.setHostName("127.0.0.1");
db.setDatabaseName("DatabaseName");
db.setPassword("Password");
db.setUserName("UserName");
if (!db.open()) {
qDebug()<< db.lastError().text();
return false;
}
return true;
}
bool createPostgreSQLConnection()
{
qDebug() << "--------------------";
qDebug() << "Postgree connection";
QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL7");
qDebug() << "DRIVERS :" << QSqlDatabase::drivers();
db.setHostName("127.0.0.1");
db.setDatabaseName("DatabaseName");
db.setPassword("Password");
db.setUserName("UserName");
if (!db.open()) {
qDebug()<< db.lastError().text();
return false;
}
return true;
}
To copy to clipboard, switch view to plain text mode
This files I got after compilation of plugin:
libqsqlpsql4.a
libqsqlpsqld4.a
qsqlpsql4.dll
qsqlpsqld4.dll
I copied this files in {QTPath}\plugins\sqldrivers and I still get this error:
--------------------
Postgree connection
QSqlDatabase: QPSQL7 driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC
DRIVERS : ("QSQLITE", "QODBC3", "QODBC")
"Driver not loaded Driver not loaded"
I have no idea what could be the problem.
Earlier today I do the same for ODBC driver(compile, copy in the folder and build application) and everything was working fine.
Could you help me?
Note: I use mingw32-make from QT distribution
Bookmarks