Results 1 to 5 of 5

Thread: Help with QMYSQL driver for QT 4.4.0: driver not loaded

  1. #1
    Join Date
    Jan 2009
    Posts
    8
    Thanks
    1

    Post Help with QMYSQL driver for QT 4.4.0: driver not loaded

    Dear,

    I have done a fair share of googling and reading post in this forum. However I am still having a problem of the application complaining of "QMYSQL driver not loaded"

    Here is what I have:

    1) The OS is redhat enterprise kernel 2.6x
    2) The OS come loaded with qt 3.6
    3) I extract qt 4.4.0 and compiled in a seperate location let's call it $QTDIR, I have compile and run other QT application fine --> suggested that I have the 4.4.0 environment set up correctly.
    4) the QTDIR has the following plugins:
    $QTDIR/plugins/sqldrivers/libqsqlite.a
    $QTDIR/plugins/sqldrivers/libqsqlmysql.a
    5) I have QT += sql in the .pro file
    6) The following code yield the following error:

    int main( int argc, char **argv )
    {
    QCoreApplication app( argc, argv );
    qDebug() << "Sql driver " << QSqlDatabase::drivers();
    QSqlDatabase db( QSqlDatabase::addDatabase( "QMYSQL" ) );
    qDebug() << db.lastError();
    }


    The result is :
    Sql driver ()
    QSqldatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers:
    QSqlError(-1, "Driver not loaded", "Driver not loaded");


    8) After extensive googling, it all seem to suggest a recompile of mysql plugin, the question is, if i already have the qsqlmysql.a in the plugins/sqldrivers/ do I still need to recompile it? What am I doing wrong?

    Please help.

    Thanks

    khikho

  2. #2
    Join Date
    Feb 2006
    Location
    Jarrell, Texas, USA
    Posts
    70
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Help with QMYSQL driver for QT 4.4.0: driver not loaded

    If it was me, I'd download and install a newer version of QT.
    If you read the configure help, it will show you how to make sure QT is configured with MySQL.

    Karl

  3. #3
    Join Date
    Jan 2009
    Posts
    8
    Thanks
    1

    Default Re: Help with QMYSQL driver for QT 4.4.0: driver not loaded

    Thanks for replying,

    For the future, I was compiling qt as static library with just the mysql plugin, this explain the present of qsqlmysql.a but not the share library.

    A reconfiguring and recompiling of qt as share library and including mysql driver, not just as a plugin, solved the problem.

    cheer
    khikho

  4. #4
    Join Date
    Feb 2011
    Posts
    3
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Post Re: Help with QMYSQL driver for QT 4.4.0: driver not loaded

    Quote Originally Posted by khikho View Post
    Thanks for replying,

    For the future, I was compiling qt as static library with just the mysql plugin, this explain the present of qsqlmysql.a but not the share library.

    A reconfiguring and recompiling of qt as share library and including mysql driver, not just as a plugin, solved the problem.

    cheer
    khikho
    I request you to mention the commands used for reconfiguring of qt as share library and including mysql driver.

  5. #5
    Join Date
    Feb 2006
    Location
    Jarrell, Texas, USA
    Posts
    70
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Help with QMYSQL driver for QT 4.4.0: driver not loaded

    If you are wanting a static build:

    Qt Code:
    1. [FONT=Arial, sans-serif]# ./configure -platform linux-g++ -prefix /usr/local/qt-4.4-static -static -release -qt-sql-mysql -qt-sql-sqlite -I /usr/include/mysql -L /usr/lib/mysql[/FONT]
    To copy to clipboard, switch view to plain text mode 

    You can refer to http://doc.qt.nokia.com/4.4/install-x11.html for more details

    Karl

Similar Threads

  1. QSqlDatabase: QMYSQL driver not loaded
    By onder in forum Newbie
    Replies: 12
    Last Post: 29th March 2017, 14:43
  2. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  3. QMYSQL driver not loaded
    By sepehr in forum Qt Programming
    Replies: 12
    Last Post: 11th January 2009, 20:15
  4. mysql 5 connection
    By GuL in forum Newbie
    Replies: 37
    Last Post: 18th August 2008, 15:11
  5. exception at 0x65100c40 (QtGuid4.dll)
    By sabeesh in forum Qt Programming
    Replies: 11
    Last Post: 21st December 2007, 17: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.