I have a QT application that requires the MySql driver. I have both a .pro file to compile the app with QtCreator and a .vcproj for Visual C++ 2008 Express. The code is identical and it compiles without a hitch, but the executable created by Visual C++ Express gives me the following output and refuses to load any driver/plugin:
QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers:
I used QCoreApplication to identify the location where the plugins are and it seems that both executables have the same path, so they should both see the plugins. One does, and the other doesn't.
The code is standard.
QSqlDatabase db;
db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("localhost");
db.setPort(3306);
db.setDatabaseName("dbase");
db.setUserName("user");
db.setPassword("pwd");
bool ok = db.open();
The same thing happens with the SqlBrowser sample that came with QT, so I don't think the code is the problem.