Results 1 to 14 of 14

Thread: QSqlDatabase: QMYSQL driver not loaded

  1. #1
    Join Date
    Dec 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QSqlDatabase: QMYSQL driver not loaded

    Hello everyone,

    After installing the latest and greatest Qt 4.6.1 on Linux (Fedora 12), I see the every popular message:
    Qt Code:
    1. QSqlDatabase: QMYSQL driver not loaded
    To copy to clipboard, switch view to plain text mode 

    this is the
    Qt Code:
    1. qt-sdk-linux-x86_64-opensource-2010.01.bin
    To copy to clipboard, switch view to plain text mode 
    installation.

    Does anyone know where to get the driver from? There probably is an RPM for this somewhere, but I can't find one
    for 4.6.1.

    Or do I have to compile all of Qt from source to add the driver?

    Thanks for any hints.

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

    have you installed mysql on your system?

  3. #3
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    tip:
    1) look below where it says 'Similar Threads'
    2) search the forum
    3) read Qt Documentation

  4. #4
    Join Date
    Dec 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    yes of course i have mysql installed on my system

  5. #5
    Join Date
    Dec 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Quote Originally Posted by schnitzel View Post
    tip:
    1) look below where it says 'Similar Threads'
    2) search the forum
    3) read Qt Documentation
    This works file with existing code under 4.5.3. It also works fine with 4.6.0 that I compiled.

    The only problem is that the QMYSQL driver is not part of the 2010.01 installation.

    The problem is not that I didn't read the documentation, thank you very much.

  6. #6
    Join Date
    Sep 2009
    Posts
    72
    Thanked 10 Times in 10 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Anyway mysql plugin might not be build in your 2010.01 Qt. Please have a look at that. if it is not build then search the forum for it. there are many threads which have resolved the issue. assuming you have not done that yet

  7. #7
    Join Date
    Dec 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Quote Originally Posted by vishwajeet.dusane View Post
    Anyway mysql plugin might not be build in your 2010.01 Qt.
    It is the 2010.01 from qt.nokia.com. The official one. Contains everything, but the MYSQL is not installed.
    That is why I was asking here.

    Please have a look at that. if it is not build then search the forum for it. there are many threads which have resolved the issue. assuming you have not done that yet
    I did search the forum before my first post, and no this particular question has not come up before. Similar ones have come up where people build things themselves. In my case I did an installation as directed by Qt.nokia.com.

  8. #8
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Quote Originally Posted by earthling View Post
    This works file with existing code under 4.5.3. It also works fine with 4.6.0 that I compiled.

    The only problem is that the QMYSQL driver is not part of the 2010.01 installation.

    The problem is not that I didn't read the documentation, thank you very much.
    I just installed qt-sdk-linux-x86-opensource-2010.01.bin and I was able to locate the following directory which includes the src for the said plugin:
    qtsdk-2010.01/qt/src/plugins/sqldrivers/mysql

    Perhaps something went wrong in your case during install.
    Last edited by schnitzel; 10th February 2010 at 18:55.

  9. #9
    Join Date
    Dec 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Indeed the source code is where it is supposed to be. However this source code is not installed in the libraries that are loaded from the binary installation file.
    Having to manually compile and install from the driver sources is not straightforward, there are no separate installation scripts. Also having to manually compile and
    install drivers is not why there is a binary installation package for everything.

    There are also no options on the sdk...2010.01.bin script relating to the SQL drivers.

    I resorted to installing the 4.6.1 release from source. The configure script on the source package does allow specification of
    which SQL drivers should be installed, along with a lot of other things.

  10. #10
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    However this source code is not installed in the libraries that are loaded from the binary installation file.
    what do you mean by this?

    Having to manually compile and install from the driver sources is not straightforward, there are no separate installation scripts.
    true, there are no 'scripts' but I don't agree that it isn't straightforward. It is very well explained in the docs.

    Also having to manually compile and install drivers is not why there is a binary installation package for everything.
    I'm not sure what you mean by this. The mysql plugin is not enabled by default, but again it is pretty simple if you follow the docs.

    There are also no options on the sdk...2010.01.bin script relating to the SQL drivers.
    Not true - the help option when you run configure tells you how.

    I resorted to installing the 4.6.1 release from source. The configure script on the source package does allow specification of
    which SQL drivers should be installed, along with a lot of other things.
    This was not necessary, but have it your way.

    I had no trouble building the mysql plugin from the 2010.01.bin.

    After installing Qt, go to the mysql plugin src directory and use the qmake command with the appropriate flags to located mysql lib and include file. You end up with a makefile and bob's your uncle.
    This is all very well explained in the docs.

  11. #11
    Join Date
    Dec 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    The configure script you talk about looks like the same one you get from the source distribution,
    AFTER you supposedly have installed everything.

    Therefore the procedure you seem to recommend is, to be complete:

    - install using the binary distribution by running qt-sdk-linux-x86_64-opensource-2010.01.bin
    (for documentation, run qt-sdk-linux-x86_64-opensource-2010.01.bin --help)
    (there are no options that let you install any SQL drivers)
    - go to the installed directory tree, find the ..sdk-2010.01/qt directory
    - do ./configure --help (as root, won't work as user), pick out the appropriate options
    - re-build what was installed in the first step with the usual configure/make/make install sequence

    Whereas installing from source is:

    - unpack the file qt-everywhere-opensource-src-4.6.1.tar.gz
    - do ./configure --help as plain user, pick out the appropriate options
    - build using the usual configure/make/make install sequence

    From configure --help, the options on the configure script relating to the sql drivers are these:
    Qt Code:
    1. -no-sql-<driver> ... Disable SQL <driver> entirely.
    2. -qt-sql-<driver> ... Enable a SQL <driver> in the QtSql library, by default
    3. none are turned on.
    4. -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
    5. at run time.
    6.  
    7. Possible values for <driver>:
    8. [ db2 ibase mysql oci odbc psql sqlite sqlite2 sqlite_symbian tds ]
    9.  
    10. -system-sqlite ..... Use sqlite from the operating system.
    To copy to clipboard, switch view to plain text mode 

    A lot of people on these forums seem to have a mental disorder that causes them to say, without apparent reason, that everything is in the docs

  12. #12
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Quote Originally Posted by earthling View Post
    (there are no options that let you install any SQL drivers)
    I was referring to the command line options for the configure command, which you have so kindly listed, not the command line options for the installer.
    I'm not sure what you were expecting from the '.bin' installer with respect to how it gets installed. The point is that all configuration happens AFTER you run the '.bin' installer.

    - go to the installed directory tree, find the ..sdk-2010.01/qt directory
    - do ./configure --help (as root, won't work as user), pick out the appropriate options
    - re-build what was installed in the first step with the usual configure/make/make install sequence
    this is not needed if you just want to build the plugin.


    Whereas installing from source is:
    I have never installed *just* the src tar ball so I cannot comment on that but obviously you have to build the entire thing which takes hours.

    A lot of people on these forums seem to have a mental disorder that causes them to say, without apparent reason, that everything is in the docs
    and some people think they are just so smart and don't need to read documentation

    Look... the binary installer is the entire sdk and also includes the source - get it? Downloading the bin installer saves you from having to build the entire sdk if you can live with the default configuration which is dynamic linking.

    Like the output from the confgure --help command says 'by default none are turned on'.
    So, right after you install the sdk from the '.bin' installer you need to go to the mysql plugin src directory and build it. That's it. No need to do anything from the 2010.01/qt directory.

    Looks like in the end you figured it all out but you went through some steps that were not needed, however you've become more familiar with how things work in Qt - congrats.
    Last edited by schnitzel; 15th February 2010 at 19:18.

  13. #13
    Join Date
    Feb 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Hello,

    I was wondering if any of you have had luck building this driver on OS X 10.5 using the QT 2010.2 package. As I've posted in this thread I am being thrown by the following two issues:

    - There is no /src/ directory in the QT installation. I have triple checked and I only see one QT installer for OS X so I am not sure how one could download QT without the source.
    - I have installed mysql and I have libmysqlclient.dylib , but there is no libmysqlclient.so . Does anyone know if working with a dynamic lib in QT is much different than a shared object?

    Many thanks!
    Lucas

  14. #14
    Join Date
    Nov 2008
    Posts
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default Re: QSqlDatabase: QMYSQL driver not loaded

    Did you ever get this sorted out on your Mac OS X, I have the same issue and I'm searching for tips on how to get it working!

Similar Threads

  1. QSqlDatabase: QMYSQL driver not loaded
    By onder in forum Newbie
    Replies: 12
    Last Post: 29th March 2017, 15:43
  2. 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
  3. Replies: 6
    Last Post: 28th April 2009, 07:58
  4. The strange problem:"QSqlDatabase: QMYSQL driver not loaded"
    By osmanthus in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd January 2009, 16:12
  5. QMYSQL driver not loaded
    By sepehr in forum Qt Programming
    Replies: 12
    Last Post: 11th January 2009, 21: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.