Results 1 to 5 of 5

Thread: QMYSQL driver not loaded

  1. #1
    Join Date
    Jun 2008
    Location
    Rome, Italy
    Posts
    95
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QMYSQL driver not loaded

    Hi to all,
    yes I've read the previous posts about it but nothing match my problem. I've compiled the MySQL driver following the Qt guide "SQL Database Drivers". Then I've checked the folder "C:\Qt\2010.02\qt\plugins\sqldrivers" in order to confirm the library installed:

    Qt Code:
    1. 10/02/2010 19.01 2.168 libqsqlite4.a
    2. 10/02/2010 19.01 2.178 libqsqlited4.a
    3. 10/03/2010 14.28 2.182 libqsqlmysql4.a
    4. 10/03/2010 14.28 2.192 libqsqlmysqld4.a
    5. 10/02/2010 19.01 2.178 libqsqlodbc4.a
    6. 10/02/2010 19.01 2.182 libqsqlodbcd4.a
    7. 10/02/2010 19.01 478.720 qsqlite4.dll
    8. 23/02/2010 09.44 1.728.157 qsqlited4.dll
    9. 10/03/2010 14.28 113.152 qsqlmysql4.dll
    10. 10/03/2010 14.28 942.617 qsqlmysqld4.dll
    11. 10/02/2010 19.01 154.624 qsqlodbc4.dll
    12. 10/02/2010 19.01 943.815 qsqlodbcd4.dll
    To copy to clipboard, switch view to plain text mode 
    it seems to be ok!

    So, I've tried to test a simple app subclassing a QWidget:

    Qt Code:
    1. #include <QSqlDatabase>
    2. #include <QDebug>
    3. #include "Widget.h"
    4. #include "ui_Widget.h"
    5.  
    6. Widget::Widget(QWidget *parent) :
    7. QWidget(parent),
    8. ui(new Ui::Widget)
    9. {
    10. ui->setupUi(this);
    11. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    12. }
    13.  
    14. Widget::~Widget()
    15. {
    16. delete ui;
    17. }
    18.  
    19. void Widget::changeEvent(QEvent *e)
    20. {
    21. QWidget::changeEvent(e);
    22. switch (e->type()) {
    23. case QEvent::LanguageChange:
    24. ui->retranslateUi(this);
    25. break;
    26. default:
    27. break;
    28. }
    29. }
    To copy to clipboard, switch view to plain text mode 

    but my "Application Output" has reported:

    Qt Code:
    1. Starting C:\Documents and Settings\D44\Desktop\testMySQL\debug\testMySQL.exe...
    2. QSqlDatabase: QMYSQL driver not loaded
    3. QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC
    To copy to clipboard, switch view to plain text mode 

    what is missing?

    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QMYSQL driver not loaded

    Have you also tried the "solutions" mentioned there under "Troubleshooting"? What does QApplication::libraryPaths() say?

  3. #3
    Join Date
    Jun 2008
    Location
    Rome, Italy
    Posts
    95
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMYSQL driver not loaded

    Yes, I've tried:

    Qt Code:
    1. qDebug() << QApplication::libraryPaths();
    To copy to clipboard, switch view to plain text mode 

    and returns:

    Qt Code:
    1. ("C:/Qt/2010.02/qt/plugins", "C:/Documents and Settings/D44/Desktop/testMySQL/debug")
    To copy to clipboard, switch view to plain text mode 

    It's correct!
    Ok, panic: Aaaaaaaagh!
    Last edited by cydside; 10th March 2010 at 14:47.

  4. #4
    Join Date
    Jun 2008
    Location
    Rome, Italy
    Posts
    95
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMYSQL driver not loaded

    Hi to all again,
    I've found the following tutorial:

    Qt Code:
    1. http://christopher.rasch-olsen.no/2009/04/14/qt-45-and-mysql-plugin-with-mingw-on-windows-xp/
    To copy to clipboard, switch view to plain text mode 

    where the guy who has wrote it talk about a lack in the Qt documentation. It seems that the tutorial on How to build MySQL libraries on Windows is working only for nmake (Visual Studio). Do you, according to you experience, confirm that?
    Unbelievable!!!

  5. #5
    Join Date
    Aug 2008
    Location
    Texas, USA
    Posts
    44
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL driver not loaded

    One thing I found with mine (Note: I am using MSVC compiler and I got the plugin to compile just fine) is that you also need the libmysql.dll file and located somewhere in your path. The libmysql.dll file is NOT included if you just install the mysql header and source files only the .lib and *.h files are. So I re-installed with the client programs and copyed the .dll to my executable folder and it works!

Similar Threads

  1. QSqlDatabase: QMYSQL driver not loaded
    By onder in forum Newbie
    Replies: 12
    Last Post: 29th March 2017, 14:43
  2. QSqlDatabase: QMYSQL driver not loaded
    By earthling in forum Qt Programming
    Replies: 13
    Last Post: 4th December 2010, 15:19
  3. QMYSQL driver not loaded
    By akhila in forum Newbie
    Replies: 1
    Last Post: 22nd February 2010, 18:24
  4. Replies: 6
    Last Post: 28th April 2009, 06:58
  5. QMYSQL driver not loaded
    By sepehr in forum Qt Programming
    Replies: 12
    Last Post: 11th January 2009, 20:15

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.