Results 1 to 7 of 7

Thread: QSqlDatabase: QMYSQL driver not loaded

  1. #1
    Join Date
    Apr 2009
    Posts
    46
    Thanks
    4
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QSqlDatabase: QMYSQL driver not loaded

    I'm getting this error when executing my program:
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC

    I tried compiling mysql (in the same way as it's shown in documention for SQLite) but I'm getting there errors aswell.

    Any suggestions?

  2. #2
    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: QSqlDatabase: QMYSQL driver not loaded

    did you try to search by forum? take a look at this search result.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Do you have MySQL installed?

    Qt Code:
    1. cd $QTDIR/src/plugins/sqldrivers/mysql
    2. qmake "INCLUDEPATH+=-I<mysql_installation_path>/include" "LIBS+=-L<mysql_installation_path>/lib -lmysqlclient_r" mysql.pro
    3. make
    To copy to clipboard, switch view to plain text mode 

    If this fails, you will need to show us the errors.
    I'm a rebel in the S.D.G.

  4. #4
    Join Date
    Apr 2009
    Posts
    46
    Thanks
    4
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    lyuts,
    Qt Code:
    1. In file included from main.cpp:40:
    2. ../../../sql/drivers/mysql/qsql_mysql.h:48:19: mysql.h: No such file or directory
    3. In file included from main.cpp:40:
    4. ../../../sql/drivers/mysql/qsql_mysql.h:103: error: expected `)' before '*' token
    5. mingw32-make[1]: *** [tmp/obj/debug_shared/main.o] Error 1
    To copy to clipboard, switch view to plain text mode 

    spirit, yes I did, but in other thread the creator of it had installed MySQL. When I list all allowed drivers, MySQL is not there.

  5. #5
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    So, as I understand you don't have MySQL installed. You need MySQL headers and libs installed in order to build this sql driver. Install them first and only then try to build mysql plugin.
    I'm a rebel in the S.D.G.

  6. #6

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    In ubuntu: the first install "MySQL database development" files with apt-get or synaptic or...

    Then:
    cd $QTDIR/src/plugins/sqldrivers/mysql

    qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro

    make

    check the include path, because my path was different: qmake "INCLUDEPATH+=/usr/include/mysql/" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
    If the path is wrong the file mysql.h never found.

    some information:
    http://doc.trolltech.com/4.5/sql-dri...rted-databases

  7. #7

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    How to get MySQL driver to work in Ubuntu

    ubuntu:~$ cd qtsdk-2009.02/qt/

    ubuntu:~$ touch LICENSE.GPL3 LICENSE.LGPL

    ubuntu:~$ ./configure -plugin-sql-mysql
    ubuntu:~$ make

    if ”qgtkstyle error” occurs, install gtk dev pagcages using apt-get (apt-get install qt4-dev-tools gtkgl-dev gtkglarea5-dev libqt4-dev libgtk2.0-dev)

    ubuntu:~$ make install
    it takes 1-3 hours.

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. Help with QMYSQL driver for QT 4.4.0: driver not loaded
    By khikho in forum Installation and Deployment
    Replies: 4
    Last Post: 1st April 2011, 16:00
  4. mysql 5 connection
    By GuL in forum Newbie
    Replies: 37
    Last Post: 18th August 2008, 16:11
  5. exception at 0x65100c40 (QtGuid4.dll)
    By sabeesh in forum Qt Programming
    Replies: 11
    Last Post: 21st December 2007, 18:10

Tags for this Thread

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.