Results 1 to 13 of 13

Thread: QMYSQL driver not loaded

  1. #1
    Join Date
    Apr 2008
    Location
    Karaj,Iran
    Posts
    43
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation QMYSQL driver not loaded

    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:
    Qt Code:
    1. cd %QTDIR%\src\plugins\sqldrivers\mysql
    2. qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\lib\opt\libmysql.lib" mysql.pro
    3. make
    To copy to clipboard, switch view to plain text mode 
    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:
    Qt Code:
    1. 1. cd c:\qt\src\plugins\sqldrivers\mysql (c:\qt is where qt is installed)
    2. 2. qmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE"
    3.  
    4. "LIBS+=-LC:\MYSQL\LIB\OPT -lmysql" mysql.pro
    5.  
    6. make
    To copy to clipboard, switch view to plain text mode 
    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
    Last edited by sepehr; 10th December 2008 at 23:05.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMYSQL driver not loaded

    http://www.qtcentre.org/forum/faq.ph...lugin_category
    [wiki]Building the QMYSQL plugin on Windows using MinGW[/wiki]

  3. #3
    Join Date
    Apr 2008
    Location
    Karaj,Iran
    Posts
    43
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL driver not loaded

    Quote Originally Posted by wysota View Post
    http://www.qtcentre.org/forum/faq.ph...lugin_category
    [wiki]Building the QMYSQL plugin on Windows using MinGW[/wiki]
    I have no idea why keep getting the "undefined reference " such as following:
    Qt Code:
    1. C:/Qt/4.4.3/src/corelib/plugin/quuid.cpp:566: undefined reference to `CoCreateGu
    2. id@4'
    3. ./tmp\obj\debug_shared\qeventdispatcher_win.o(.text+0x2ac5): In function `ZN28QE
    4. ventDispatcherWin32Private16doWsaAsyncSelectEi':
    5. C:/Qt/4.4.3/src/corelib/kernel/qeventdispatcher_win.cpp:619: undefined reference
    6. to `WSAAsyncSelect@16'
    To copy to clipboard, switch view to plain text mode 
    the last thing i tried was calling mingw32-make after following instructions at "MinGW tips"
    section of:
    http://wiki.qtcentre.org/index.php?t...ws_using_MinGW

    i'm stuck!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMYSQL driver not loaded

    What exactly step by step did you do? Please include details such as names of archives you downloaded and info about your environment.

  5. The following user says thank you to wysota for this useful post:

    sepehr (11th December 2008)

  6. #5
    Join Date
    Apr 2008
    Location
    Karaj,Iran
    Posts
    43
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL driver not loaded

    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
    dos Code:
    1. cd C:\MYSQL\lib\opt
    2. reimp libmysql.lib
    To copy to clipboard, switch view to plain text mode 
    then cd into C:\Qt\4.4.3\src\plugins\sqldrivers\mysql and then i run
    dos Code:
    1. qmake -o Makefile "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MySQL\lib\opt\liblibmysql.a" mysql.pro
    To copy to clipboard, switch view to plain text mode 
    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
    Qt Code:
    1. tmp/obj/debug_shared/moc_qsql_mysql.o(.rdata$_ZTV12QMYSQLDriver[vtable for QMYSQ
    2. LDriver]+0x7c):c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4
    3. .2/bits/locale_facets.tcc:2502: undefined reference to `QSqlDriver::setLastError
    4. (QSqlError const&)'
    To copy to clipboard, switch view to plain text mode 
    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
    Last edited by wysota; 3rd January 2009 at 00:18.

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMYSQL driver not loaded

    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.

  8. #7
    Join Date
    Apr 2008
    Location
    Karaj,Iran
    Posts
    43
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL driver not loaded

    Quote Originally Posted by wysota View Post
    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,

  9. #8
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMYSQL driver not loaded

    are you sure that this file name is correct 'liblibmysql.a'? maybe 'libmysql.a'?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  10. #9
    Join Date
    Apr 2008
    Location
    Karaj,Iran
    Posts
    43
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL driver not loaded

    Quote Originally Posted by spirit View Post
    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

  11. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMYSQL driver not loaded

    It really should be libmysql.a...

  12. #11
    Join Date
    Apr 2008
    Location
    Karaj,Iran
    Posts
    43
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL driver not loaded

    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

  13. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMYSQL driver not loaded

    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).

  14. The following user says thank you to wysota for this useful post:

    sepehr (11th January 2009)

  15. #13
    Join Date
    Apr 2008
    Location
    Karaj,Iran
    Posts
    43
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL driver not loaded

    Quote Originally Posted by wysota View Post
    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

Similar Threads

  1. QSqlDatabase: QMYSQL driver not loaded
    By onder in forum Newbie
    Replies: 12
    Last Post: 29th March 2017, 15:43
  2. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 10:49
  3. mysql 5 connection
    By GuL in forum Newbie
    Replies: 37
    Last Post: 18th August 2008, 16:11
  4. SQlite driver not loaded error
    By ibergmark in forum Installation and Deployment
    Replies: 2
    Last Post: 17th March 2008, 02:09
  5. exception at 0x65100c40 (QtGuid4.dll)
    By sabeesh in forum Qt Programming
    Replies: 11
    Last Post: 21st December 2007, 18:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.