View Full Version : QMYSQL driver not loaded
sepehr
10th December 2008, 21:57
when trying to connect to a mysql database it gives the "QMYSQL driver not loaded" error
,I have installed qt using installer(and not the source) and it doesn't seem to have the qsqlmysql.dll file,i don't have it in sql drivers folder,i tried compiling the driver myself using the way mentioned in qt docs as follows:
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\lib\opt\libmysql.lib" mysql.pro
make
but when I submit the make command i get alot of " undefined reference to ..."
someone in a forum had the same problem as me and he made it work doing the following:
1. cd c:\qt\src\plugins\sqldrivers\mysql (c:\qt is where qt is installed)
2. qmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE"
"LIBS+=-LC:\MYSQL\LIB\OPT -lmysql" mysql.pro
make
but for me,again make phase gives erros,I have been searching for hours and trying couple of solutions but no luck so far,could someone tell me what to do? how to make that qsqlmysql.dll file?
thanks in advance
ps:
my mysql version is:
5.0.41-community-nt
my gcc version is:
3.4.2 (mingw-special)
my QT version is:
4.4.3
wysota
10th December 2008, 22:22
http://www.qtcentre.org/forum/faq.php?faq=qt_faq_section#faq_qt_compiling_mysql_ plugin_category
Building the QMYSQL plugin on Windows using MinGW
sepehr
11th December 2008, 00:16
http://www.qtcentre.org/forum/faq.php?faq=qt_faq_section#faq_qt_compiling_mysql_ plugin_category
Building the QMYSQL plugin on Windows using MinGW
I have no idea why keep getting the "undefined reference " such as following:
C:/Qt/4.4.3/src/corelib/plugin/quuid.cpp:566: undefined reference to `CoCreateGu
id@4'
./tmp\obj\debug_shared\qeventdispatcher_win.o(.text+ 0x2ac5): In function `ZN28QE
ventDispatcherWin32Private16doWsaAsyncSelectEi':
C:/Qt/4.4.3/src/corelib/kernel/qeventdispatcher_win.cpp:619: undefined reference
to `WSAAsyncSelect@16'
the last thing i tried was calling mingw32-make after following instructions at "MinGW tips"
section of:
http://wiki.qtcentre.org/index.php?title=Building_the_QMYSQL_plugin_on_Wind ows_using_MinGW
i'm stuck!:confused:
wysota
11th December 2008, 01:13
What exactly step by step did you do? Please include details such as names of archives you downloaded and info about your environment.
sepehr
11th December 2008, 08:58
i installed mysql in c:\mysql,
include files are installed and are located in C:\MYSQL\include
lib files are in C:\MYSQL\lib\opt
i didn't have reimp utility so i downloaded it from sourceforge and put it in bin directory of mingw(later i put it in qt bin directory too)
then I did
cd C:\MYSQL\lib\opt
reimp libmysql.lib
then cd into C:\Qt\4.4.3\src\plugins\sqldrivers\mysql and then i run
qmake -o Makefile "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MySQL\lib\opt\liblibmysql.a" mysql.pro
and while i'm in C:\Qt\4.4.3\src\plugins\sqldrivers\mysql directory i run make command
some stuff go well at first but i get these undefined reference erros
tmp/obj/debug_shared/moc_qsql_mysql.o(.rdata$_ZTV12QMYSQLDriver[vtable for QMYSQ
LDriver]+0x7c):c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
.2/bits/locale_facets.tcc:2502: undefined reference to `QSqlDriver::setLastError
(QSqlError const&)'
what could be wrong?couldn't this be a version conflict of mingw,qt or mysql?
i have to get mysql driver running,what else can i do? any other solutions?
--
thanks again
wysota
11th December 2008, 10:23
I would try running configure with options to enable mysql support and then cd into the directory containing the plugin and run make there. There might have been some changes in Qt that modified the way plugins are build and those instructions might be wrong.
sepehr
11th December 2008, 11:26
I would try running configure with options to enable mysql support and then cd into the directory containing the plugin and run make there. There might have been some changes in Qt that modified the way plugins are build and those instructions might be wrong.
i did that,the same errors cameup,:(
spirit
11th December 2008, 13:51
are you sure that this file name is correct 'liblibmysql.a'? maybe 'libmysql.a'?
sepehr
11th December 2008, 14:15
are you sure that this file name is correct 'liblibmysql.a'? maybe 'libmysql.a'?
yes I'm sure it's liblibmysql.a,i checked it
wysota
11th December 2008, 15:18
It really should be libmysql.a...
sepehr
11th January 2009, 12:48
there was just a versioning issue and the problem got fixed by upgrading mysql server and I could make those mysql drivers DLLs ,now is there anything other than DLL files that I should ship ? because I get the same error on other machines trying to execute my program despite of having the DLLs
wysota
11th January 2009, 19:44
You should ship the Qt MySQL driver (qmysql.dll) and MySQL client library (mysqlclient.dll or mysql.dll or something like that). The driver has to be placed in the sqldrivers subdirectory of your application's installation directory and MySQL library either in the installation directory or in a system directory (like C:\Windows\System32).
sepehr
11th January 2009, 20:15
You should ship the Qt MySQL driver (qmysql.dll) and MySQL client library (mysqlclient.dll or mysql.dll or something like that). The driver has to be placed in the sqldrivers subdirectory of your application's installation directory and MySQL library either in the installation directory or in a system directory (like C:\Windows\System32).
from QT docs
Plugins work differently to normal DLLs, so we can't just copy them into the same directory as our application's executable as we did with the Qt DLLs. When looking for plugins, the application searches in a plugins subdirectory inside the directory of the application executable.
So to make the plugins available to our application, we have to create the plugins subdirectory and copy over the relevant DLLs:
plugins\pnp_basictools.dll
plugins\pnp_extrafilters.dll
it was not mentioned that sql drivers DLL files should be put in a subdirectory called sqldrivers within plugins directory,thanks wysota
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.