Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] Qt 5.0 MySQL driver compile and find, but not load
Forum Updated to NodeBB v4.3 + New Features

[solved] Qt 5.0 MySQL driver compile and find, but not load

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 7.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    agiacomolli
    wrote on last edited by
    #1

    I'm trying to use the Qt 5.0 MySQL driver with Visual Studio 10.0 compiler, but some strange behaviour happens when I load it. Adding a MySQL database with the code:

    @
    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    @

    I receive the warning below. It's the same generated with QMYSQL3.

    @
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3
    @

    Apparently Qt's plugin system correct find it, but for some reason can't load.

    The plugin was build in accordance with the sql-driver.html doc as follow at Windows 32 and 64 bit using MySQL 5.5.29 (32 bit).

    @
    cd C:\Qt\5.0.0\5.0.0\Src\qtbase\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MySQL/lib/libmysql.lib" mysql.pro
    nmake
    nmake install
    @

    Has anybody encontered the same problem?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cincirin
      wrote on last edited by
      #2

      Where do you put qsqlmysql4.dll and libmysql.dll ?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        agiacomolli
        wrote on last edited by
        #3

        Hi,

        MySQL was installed in

        @C:\MySQL@

        The plugin is created successfully and Qt finds.

        Update: I found a guy with the same "issue":http://stackoverflow.com/questions/14207088/qt-5-odbc-driver-issue in ODBC driver.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cincirin
          wrote on last edited by
          #4

          Ok maybe you misunderstand my question :-) So you need to have libmysql.dll in application folder path ( or in environment path ) and qsqlmysql4.dll must be in sqldrivers subfolder of application path.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            agiacomolli
            wrote on last edited by
            #5

            Very basic failure. I forgot to copy libmysql.dll in application folder.

            Thanks for replay :)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              angelicaP
              wrote on last edited by
              #6

              hi all,

              which is this "environment path" or "application folder"

              where should i copy this file?
              thanks

              1 Reply Last reply
              0
              • A Offline
                A Offline
                angelicaP
                wrote on last edited by
                #7

                i have the mingw compiler installed

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  angelicaP
                  wrote on last edited by
                  #8

                  i think i found it; it's the "bin" folder from mingw path.
                  all the best

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kalempir
                    wrote on last edited by
                    #9

                    how is libmysql.dll called in linux?
                    I have the same problem now. Native mysql driver not compatible with my mysql so I recompile and cp it to plugins/sqldrivers folder, application folder. application cannot load it but see it in drivers list.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved