I have succeed compiling mysql driver with x64-4.8.1-posix-seh-rev2 but in the demo when try to open the database, I got this
Error – RtlWerpReportException failed with status code :-1073741823. Will try to launch the process directly
After i try to rebuild the driver for some times, it’s still wrong, but the error message is different
QObject::moveToThread: Current thread (0×256f30) is not the object’s thread (0×1c2a210).
Cannot move to target thread (0×256f30)
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3
QSqlError(-1, “Driver not loaded”, “Driver not loaded”)
Then I try to use the 32bit version everything goes well.
Here is my code
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("192.168.0.10");
db.setPort(3306);
db.setDatabaseName("tests");
if ( !db.open("root", "xxxxx"))
{
qDebug() << db.lastError();
}
else
{
qDebug() << "open database succeed!";
QSqlQuery query;
query.exec("show tables;");
while (query.next())
{
qDebug() << query.value(0).toString();
}
}
————————————————
Best Regards,
Leo.Lei
↧