[SOLVED] - MYSQL driver Found but not Loaded in Windows XP / 2003
I'm having problems when I want to open an MYSQL database.
Here's my setup :
- environment variable QT_DEBUG_PLUGINS set to 1
- O.S. Windows XP / Windows 2003
- Qt version 5.3
- Mysql C connector version 6.1.5
Source code executed to open DB :
db.setHostName( hostName );
db.setDatabaseName( databaseName );
db.setUserName( databaseUser );
db.setPassword( databasePassword );
res = db.open();
and I got this output :
QFactoryLoader::QFactoryLoader() looking at "C:/Program Files/MySQL/MySQL Connector.C 6.1/lib/sqldrivers/qsqlmysqld.dll"
Found metadata in lib C:/Program Files/MySQL/MySQL Connector.C 6.1/lib/sqldrivers/qsqlmysqld.dll, metadata=
Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
loaded library "C:/Qt/Qt5.3.2/5.3/mingw482_32/plugins/sqldrivers/qsqlmysqld.dll"
QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.3.2/5.3/mingw482_32/plugins/sqldrivers/qsqlmysqld.dll" : "Cannot load library C:/Qt/Qt5.3.2/5.3/mingw482_32/plugins/sqldrivers/qsqlmysqld.dll: The specified procedure could not be found."
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
I've copied the file libmysql.dll to QtXXX/bin/ ... and all other paths indicated by qApp->librartPaths.
But still the same error.
Strange thing is that this same setup works fine on Windows 7.
Ideas ? Suggestions ?
[Edited: Added Code tags "@@" - p3c0]
BTW : dependencywalker shows no error.
Are you sure that the MySQL dll's can be found by the application e.g. is the folder containing them in the PATH environment variable ?
Yes. In my case the libmysql.dll is located at C:\Program Files\MySQL\MySQL Connector.C 6.1\lib\ that it is already in the path.
Then, did you check the PATH environment variable in Qt Creator in the Run panel ?
Yes. Also there. Actually it is defined at operating system level.
Hi, do you get the same error in Release build (instead of Debug)?
I have the same problem on Qt 5.4,I use Qt in Windows 7 and Mint17.I have tried " Release build",but error still exist.
And when I get the debug infomation,I find that it says:
libqsqlmysql.so: (/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.16: version `libmysqlclient_16' not found (required by /opt/Qt5.4.0/5.4/gcc_64/plugins/sqldrivers/libqsqlmysql.so))"
but I just have libmysqlclient_r.so.18... ...
though I make symbolic links,It still doesn't work
You need to either install the .16 version or rebuild the plugin against your .18 version
... same error on release version ...also now using Qt 5.4 ...
Hi, googled a bit on why your MySQL Connector/C version 6.1.5 does not load and found some bad news: it seems starting with MySQL version 5.6 using it on Win XP or Win2K3 "is no longer supported":http://dev.mysql.com/doc/relnotes/connector-c/en/news-6-1-2.html (not a happy new year :-(
Thanks for your answer !!! ...
So I think that in machines with XP or 2003 I'll use another DB.