Results 1 to 20 of 22

Thread: Yet *another* MYSQL drivers not loaded issue

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2009
    Posts
    140
    Thanks
    22
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Yet *another* MYSQL drivers not loaded issue

    Hi,

    I've installed Qt 4.7.2 using the QtSDK installer, and I don't know how to get Qt to build/load the MySQL driver, which i need. I didn't see any config file in the QtSDK directory, and there's no such options given by the wizard. So ./configure -qt-sql-mysql isn't an option, and this thread

    http://www.qtcentre.org/threads/3401...t-loaded-issue

    didn't help me either. How can I get the driver? (I'm currently getting the 'QSqlDatabase: QMYSQL driver not loaded' error.)

  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: Yet *another* MYSQL drivers not loaded issue

    Do you have MySQL client libraries installed?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2009
    Posts
    140
    Thanks
    22
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Yet *another* MYSQL drivers not loaded issue

    Yes, should have mentioned that. I have a MySQL database that I can access perfectly well through the Query Browser and via PHP (phpMyAdmind or my own scripts).

    Edit: I've also now tried to install support for mysql with the traditional ./configure method on an installation of 4.7.2 that I downloaded without the installer (creates the folder qt-everywhere-opensource-src-4.7.2). Trying to configure with -qt-sql-mysql, it stops halfway through and gives me this:

    MySQL support cannot be enabled due to functionality tests!
    ...
    If you believe this message is in error you may use the continue
    switch (-continue) to ./configure to continue.

    When I continue, the installation completes but I still don't have MySQL support.
    Last edited by MattPhillips; 13th April 2011 at 15:12.

  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: Yet *another* MYSQL drivers not loaded issue

    What is the path to MySQL client library?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Aug 2009
    Posts
    140
    Thanks
    22
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Yet *another* MYSQL drivers not loaded issue

    Wysota,

    I can't find libmyqslclient.so, which a little googling suggested is the relevant library. It's not in /usr or /etc.
    $whereis mysql
    gives me

    mysql: /usr/bin/mysql /etc/mysql /usr/lib/mysql /usr/lib64/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
    In /usr/lib/mysql/plugin and /usr/lib/mysql/plugin I have ha_innodb_plugin.so.

    The MySQL administrator says the socket for the server instance (which is running) is /var/run/mysqld/mysqld.sock, if that helps.

  6. #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: Yet *another* MYSQL drivers not loaded issue

    Without libmysqlclient.so you can't access MySQL databases. When I was asking if you had it installed you said yes. So decide whether you have mysql client libraries installed or not. If not then install them.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Aug 2009
    Posts
    140
    Thanks
    22
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Yet *another* MYSQL drivers not loaded issue

    Hmm, it's not really a 'decision' is it... I wasn't sure whether I had the client libraries installed or not, since I have the MySQL server running and perfectly accessible through other means, in the Ubuntu software center MySQL Client is marked as 'installed', and I haven't had this problem in the past (I've mysql via previous versions of Qt, perhaps on a different version of Ubuntu--I can't be sure). Anyway, I found a package which put libmysqlclient.so.15 and *.16 in /usr/lib. I restarted but Qt still didn't see MySQL.

    Edit: If I try to #include <QMYSQLDriver>, I get 'mysql.h: no such file or directory', deriving from

    Qt Code:
    1. #include <mysql>
    To copy to clipboard, switch view to plain text mode 

    in qsql_mysql.h. Subsequent searching for mysql.h in the file system didn't turn up anything.

    Edit 2: I now have mysql.h in /usr/include/mysql, and the path added to INCLUDEPATH in my .pro file. Also libmysqlclient.a in /usr/lib, and similarly

    LIBS += -L/usr/lib -lmysqlclient
    Still 'mysql driver not loaded'.

    Edit 3: So now, I tried to install 4.7.2 from the .tar file with configure options -static -release -qt-sql-mysql. It configured ok and then about an hour into the make, failed with

    In function 'global constructors keyed to main':
    main.cpp: (.text+0x1): undefined reference to 'qt_plugin_instance_qsqlite()'
    Last edited by MattPhillips; 18th April 2011 at 05:30.

  8. #8
    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: Yet *another* MYSQL drivers not loaded issue

    Why would you try to include QMYSQLDriver?

    For MySQL plugin to work you need:
    1. MySQL client library called "mysqlclient"
    2. Qt MySQL plugin which either is already built and ready or to build it you need:
    a) Qt source code
    b) MySQL development files (headers)
    c) MySQL client library (called "mysqlclient")

    ... and possibly dependencies of any of those. In addition to that if you run Windows you need to make sure you build the plugin in the appropriate mode (debug vs release).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Aug 2009
    Posts
    140
    Thanks
    22
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Yet *another* MYSQL drivers not loaded issue

    Ok so I rebuilt 4.7.2 from the .tar file but this time without the -static option, as some searching indicated that sqlite was incompatible with a static build. After doing this, the mysql drivers were available with that version of Qt (hooray!). So clearly all the needed dev files are available. Qt Docs indicate I should find a mysql.pro file in src/plugins/sqldrivers/mysql, but I found one only in the QtSDK/QtSources/4.7.1 directory, not QtSDK/QtSources/4.7.2. Simply copying it into 4.7.2 and trying to build there didn't work, too many other files were missing. So I built the 4.7.1 version, and when I rebuilt and ran my program using the installer's version of Qt, I still got QMYSQL driver not loaded. So I can survive for now but the installer was supposed to make life easier I thought... I'd still like to know what's wrong there.

  10. #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: Yet *another* MYSQL drivers not loaded issue

    You missed out a very important piece of information in your earlier posts - that you're building Qt in static mode. You can't use regular plugins with statically built Qt. You need the static flavour of plugins that your application needs to be explicitly linked against.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Aug 2009
    Posts
    140
    Thanks
    22
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Yet *another* MYSQL drivers not loaded issue

    Using the Qt installer, the option is never presented as to whether to build dynamically or statically, but judging by the size of the executable it's clearly a dynamic build. So how do I build the drivers for it?

Similar Threads

  1. Mysql drivers
    By thahir1986 in forum Newbie
    Replies: 2
    Last Post: 26th October 2010, 07:07
  2. Building MySQL QT Drivers on Windows XP
    By cia.michele in forum Newbie
    Replies: 6
    Last Post: 16th August 2010, 18:54
  3. Installing QT in windows with mysql drivers
    By roncriss in forum Installation and Deployment
    Replies: 0
    Last Post: 20th November 2009, 03:45
  4. mysql drivers for QT-4.5.2
    By jsmith in forum Qt Programming
    Replies: 1
    Last Post: 31st August 2009, 11:33
  5. Mysql drivers install problems
    By cyberboy in forum Qt Programming
    Replies: 20
    Last Post: 2nd February 2008, 14:11

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.