MySQL Driver not loaded on PC without Qt
hi,
first of all: i'm native german so bear please with me if my english looks strange sometimes ;)
i wrote an application which communicates with a mysql-server.
everything works fine on my pc, but when i want to use it on a pc without Qt, the mysql-driver is missing.
i copied the qsql_mysql4.dll in the application path, but it still won't work.
so i tried something else: i copied the dll in the application path on my machine and renamed the library in the /qt/plugins/sqldrivers-path aaaaand: my computer is also unable to connect to the server because of the missing driver.
my app searches only in /qt/plugins/sqldrivers and nowhere else.
i also tried to add library path using the addLibraryPaths()-method without success.
i could compile the application completely static to make it work, but there has to be a better solution for this.
is there a way to change that behaviour?
Re: MySQL Driver not loaded on PC without Qt
Scroll the webpage down until you see a section called "Similar Threads". Click and enjoy.
Re: MySQL Driver not loaded on PC without Qt
i tried everything mentioned on the other threads except clearing the cache before. (tried to copy the sqldriver-folder into the app-folder, even the whole plugins-folder didn't change anything)
but i don't think clearing would help since i'm able to use the driver as long as it is in qt/plugins/sqldrivers/ .
i just don't get what is wrong :/
Re: MySQL Driver not loaded on PC without Qt
Quote:
Originally Posted by
KTvsPeacock
tried to copy the sqldriver-folder into the app-folder
So how exactly does the file/folder structure look like? Assuming your application is installed in /App and is called "app"...
/App/app.exe
/App/???
Re: MySQL Driver not loaded on PC without Qt
structure:
1st try:
/App/app.exe
/App/QtCore4.dll
/App/QtGui4.dll
/App/QtNetwork4.dll
/App/QtSql4.dll
/App/QtWebkit4.dll
/App/QtXmlPatterns4.dll
/App/qsqlmysql4.dll
2nd try:
/App/app.exe
.
.
.
/App/sqldrivers/qsqlmysql4.dll
3rd try:
/App/app.exe
.
.
.
/App/plugins/sqldrivers/qsqlmysql4.dll
everytime i got the message that the driver is missing, if its also removed from the qt-path
Re: MySQL Driver not loaded on PC without Qt
Then read the first of "similar threads" careful! First answer is your solution. You are missing an important library for MySQL (and this was a BIG hint...)!
Re: MySQL Driver not loaded on PC without Qt
you mean the libmysql.dll right?
sorry, i just forgot to mention it, but it was already in the app-folder.
Re: MySQL Driver not loaded on PC without Qt
If you are using the "Qt Sdk" (libraries+Creator) release of Qt be sure you copy files from the right directory.
Re: MySQL Driver not loaded on PC without Qt
i got a same problem... on my machine i can find following
locate qt|grep -i mysql
/usr/include/qt4/Qt/qsql_mysql.h
/usr/include/qt4/QtSql/QMYSQLDriver
/usr/include/qt4/QtSql/QMYSQLResult
/usr/include/qt4/QtSql/qsql_mysql.h
/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so
/usr/share/doc/libqt4-sql-mysql
/usr/share/doc/libqt4-sql-mysql/LGPL_EXCEPTION.txt
/usr/share/doc/libqt4-sql-mysql/changelog.Debian.gz
/usr/share/doc/libqt4-sql-mysql/changelog.gz
/usr/share/doc/libqt4-sql-mysql/copyright
/var/lib/dpkg/info/libqt4-sql-mysql.list
/var/lib/dpkg/info/libqt4-sql-mysql.md5sums
is the /usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so right library???
Re: MySQL Driver not loaded on PC without Qt
Huh, are we now talking about Linux? Wasn't it windows in the first:confused:
EDIT: Ah, different guy! You are targeting which distro? The most have qt installed, so you normally don't need to deliver the Qt libraries along your application.
EDIT 2: Yeah, noticed that. Took a while...
Re: MySQL Driver not loaded on PC without Qt
Re: MySQL Driver not loaded on PC without Qt
i'm using the qt sdk and i took the dll from the qt/bin-folder (except the qsqlmysql4.dll of course).
doesn't QApplication only looks in the given library paths for plugins?
normally it searches in qt/plugins/ and the app-folder. i removed both using setLibraryPath(""), but still the qsqlmysql4.dll in qt/plugins was found and used. this is confusing :confused:
Re: MySQL Driver not loaded on PC without Qt
The plugin has to reside in a sqldrivers subdirectory of the directory containing the binary of your application.
Re: MySQL Driver not loaded on PC without Qt
you mean like this:
"2nd try:
/App/app.exe
.
.
.
/App/sqldrivers/qsqlmysql4.dll"
i already tried this :/
Re: MySQL Driver not loaded on PC without Qt
Maybe you were missing something else too, like the MySQL client library.
Re: MySQL Driver not loaded on PC without Qt
Isn't this the libmysql.dll?
It's in the /App-folder. If I try to put it somewhere else, the application won't start.
Somewhere has to be an entry that tells something like "look only in qt/plugins for plugins no matter what you're supposed to do".
Re: MySQL Driver not loaded on PC without Qt
Quote:
Originally Posted by
KTvsPeacock
It's in the /App-folder. If I try to put it somewhere else, the application won't start.
It should start. Your main application shouldn't depend on the mysql client library. What does dependency walker say?
Re: MySQL Driver not loaded on PC without Qt
You were right: it starts without libmysql.dll.
It depends on kernel32, mingwm10, msvcrt, libgcc_s_dw2-1, qtcore4, qtgui4, qtsql4, and qtwebkit4.dll
///
This is what I get, when I call the libraryPaths()-method of my application:
("D:/Programme/Qt/qt/plugins", "C:/Release/nV/release")
So I removed the first path calling removeLibraryPath("D:/Programme/Qt/qt/plugins").
Called librayPath() again, got only the second path and still the application took the dll from the removed path.
Re: MySQL Driver not loaded on PC without Qt
But what exactly is the problem with the first path being there?
Re: MySQL Driver not loaded on PC without Qt
The problem is that my Application only searches in that path, no matter what, for plugins.
I could add thousand additional paths and put the needed dll in every single one of them, but only the one lies in the qt/plugins-path will be used.
And this is not that good, if I want to use my application on a PC without Qt :/