Problem using Mysql driver
-
as you said I ahev done that now using this
@#include <QtGui/QApplication>
#include <QtSql>int main(int argc, char *argv[])
{
QApplication a(argc, argv);QSqlDatabase::addDatabase("MYSQL"); return a.exec();
}
@I am getting this error now :
Starting C:\Users\Administrator\Desktop\testger-build-desktop\release\testger.exe...
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlite4.a"
"The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlite4.a' is not a valid Qt plugin."
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlited4.a"
"The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlited4.a' is not a valid Qt plugin."
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysql4.a"
"The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysql4.a' is not a valid Qt plugin."
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysqld4.a"
"The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysqld4.a' is not a valid Qt plugin."
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbc4.a"
"The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbc4.a' is not a valid Qt plugin."
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbcd4.a"
"The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbcd4.a' is not a valid Qt plugin."
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlite4.dll"
keys ("QSQLITE")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlited4.dll"
"The plugin 'C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlited4.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlmysql4.dll"
keys ("QMYSQL3", "QMYSQL")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlmysqld4.dll"
"The plugin 'C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlmysqld4.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlodbc4.dll"
keys ("QODBC3", "QODBC")
QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlodbcd4.dll"
"The plugin 'C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlodbcd4.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"
not a plugin
QSqlDatabase: MYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL3 QMYSQL QODBC3 QODBC -
change it but the same output
-
Output in your last post is simply a debug and it is ok that it contains all this strings. Is behavior changed or still database is unavailable?
-
surprisingly it's come up . thanks a lot but i think they are subtle things going on . thanks very much
-
I too am struggling with the QMYSQL driver issue in building a Windoze application. A first with Qt 4.6 commercial & VS 2008, I follow the plugin instrictions in Assistant, the "driver is not loaded" and the Assistant says it's usually an issue with the build key. Perhaps someone could suggest a solution to this.
In Linux I recompiled the Qt source with Mysql in the configuration or something like that, and life was good. Do I have to do the same in Winblows too?
This shouldn't be so difficult. Come on Qt experts, let go of the little details please.
-
I solved mine on a french source. I used qt creator to built on the commande line. but really this drivers gives some unexpected result from time to time . i succed to built and test it, 2 days later i tried to work on my project it wsa not working any more . my source is "Here":http://giminik.developpez.com/articles/C++-Qt4/installation-mysql-firebird-openssl/
its in french but to summarize . you need to install mysql with the header files .
assuming u have Mingw install do this on cammand line
@cd C:\MySQL-5.0\lib\opt
reimp -d libmysql.lib@note sometimes reimp is not in your mingw bin folder, so u need "Download":ftp://ftp-developpez.com/giminik/C++/Qt4/installation-mysql-firebird-openssl/mingw-utils-0.3.tar.gz
or in mingw utilities folder from sourgeforge.net
after u need to do this @dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a@ this process is to make the lib file compatible with mingw implementation.
now u ill need to compile the mysql driver by linking to the lib file that was created in the last process . it is the as in the documentation, but to make u'r life easier i would recomand u to use qt command line tool Mingw . if for some reason u d'ont want there is always a way around. just beaware that compiling with eithercompiler can bring your error. my solution was to clean up everithing and compile again -
After upgrade to QT 4.7 on windows, I encountered a new problem which I did not have previously: reimp 0.3 and also 0.41 does not work with current version 6.02 of libmysql.dll:
reimp -d libmysql.dll
reimp: libmysql.dll: invalid or corrupt import libraryHow can I compile the mysql plugin now?