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



  • 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?



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



  • 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.



  • 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.



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

    Thanks for replay :)



  • hi all,

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

    where should i copy this file?
    thanks



  • i have the mingw compiler installed



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



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.