grzywacz
22nd August 2006, 12:10
[solved]
Hi everyone,
I've searched the forum, but none of the previous odbc-related threads has answered my question... :( I can't open an ODBC data source, my program (sample source below) fails with an obscure error message which reads:
"Driver not loaded Driver not loaded"
Yes, it's repeated twice. I try to connect to a database (either MySQL or PostgreSQL) through unix odbc. I have the drivers installed and configured, as well as samle DSNs, and I can browse throug them with DataManager - everything works fine. I've compiled the QSqlODBC plugin from sources (the same version as the library I have installed from Debian's packages) and put it in /usr/lib/qt4/pluings/sqldrivers. The QSqlDatabase::drivers() returns:
("QPSQL7", "QPSQL", "QMYSQL3", "QMYSQL", "QSQLITE", "QSQLITE2", "QODBC3", "QODBC")
Therefore I belive that the plugin is ok. Just to make sure, I've tried to compile it with ODBC_CHECK_DRIVER undefined, as suggested in the documentation - no luck.
My code looks like:
QSqlDatabase db;
db.addDatabase("QODBC");
db.setDatabaseName("Driver={MySQL};Server=localhost;Database=test;Uid= test;Pwd=test;");
if(!db.open()) {
qDebug() << db.lastError().text();
exit(1);
}
Any clues? :confused:
Hi everyone,
I've searched the forum, but none of the previous odbc-related threads has answered my question... :( I can't open an ODBC data source, my program (sample source below) fails with an obscure error message which reads:
"Driver not loaded Driver not loaded"
Yes, it's repeated twice. I try to connect to a database (either MySQL or PostgreSQL) through unix odbc. I have the drivers installed and configured, as well as samle DSNs, and I can browse throug them with DataManager - everything works fine. I've compiled the QSqlODBC plugin from sources (the same version as the library I have installed from Debian's packages) and put it in /usr/lib/qt4/pluings/sqldrivers. The QSqlDatabase::drivers() returns:
("QPSQL7", "QPSQL", "QMYSQL3", "QMYSQL", "QSQLITE", "QSQLITE2", "QODBC3", "QODBC")
Therefore I belive that the plugin is ok. Just to make sure, I've tried to compile it with ODBC_CHECK_DRIVER undefined, as suggested in the documentation - no luck.
My code looks like:
QSqlDatabase db;
db.addDatabase("QODBC");
db.setDatabaseName("Driver={MySQL};Server=localhost;Database=test;Uid= test;Pwd=test;");
if(!db.open()) {
qDebug() << db.lastError().text();
exit(1);
}
Any clues? :confused: