Results 1 to 10 of 10

Thread: MySQL 5.5 plugin

  1. #1
    Join Date
    Aug 2009
    Location
    Greece
    Posts
    69
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default MySQL 5.5 plugin

    Has anybody compiled a working qmysql plugin with MySQL 5.5?
    I have tried in windows both with mingw32 on a windowsXp and with MSVC (x64) on a windows7(x64 ofcourse). Though the plugin seems to have been created successfully with no compile error and is placed in Qt's plugin folder alongside the other sqldrivers plugins it cannot be loaded. QSqlDatabase::isDriverAvailable("QMYSQL") always returns false.

    Some notes:
    -MySQL's dll libmysql.dll is not anymore in /path/to/MySQL/lib/opt but in lib. path/to/Include haven't changed place.
    -I had succesufully compiled MySQL 5.1 many times before, so I am aware of the INCLUDEPATH and LIBS on qmake as well as the reimp and all for mingw.
    -I cleaned up the registry cache after every build.
    -I am now using Qt 4.7.2 but i also tried it with 4.7.0 (on my windows machines)

    In the weekend I' ll try it on my arch linux. Until then any help would be appreciated.
    Thanx

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: MySQL 5.5 plugin

    Is the dll for mysql available for the linker during runtime?
    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. The following user says thank you to wysota for this useful post:

    Rhayader (2nd March 2011)

  4. #3
    Join Date
    Aug 2009
    Location
    Greece
    Posts
    69
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL 5.5 plugin

    wysota you are amazing. I thought it was in the PATH but it wasn't. I copied it to MySQL/bin (which I have in PATH) and all works fine. Makes me feel stupid for trying for two days and not seeing this.
    Many thanks

  5. #4
    Join Date
    Oct 2007
    Posts
    32
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MySQL 5.5 plugin

    I did the same thing on QT 4.7.2 & MySQL 5.5 with mingw-32 toolchain but bad luck.

    Here is what I had done so far.
    1. download the QT 4.7.2 lib http://get.qt.nokia.com/qt/source/qt....7.2-mingw.exe
    2. download the QT 4.7.2 src http://get.qt.nokia.com/qt/source/qt...-src-4.7.2.zip
    3. install the 1 & 2 package in c:\QT folder
    4. download the MySQL 5.5 (mysql-5.5.10-win32.msi)
    5. install into c:\qt\mysql55
    6. in C:\Qt\4.7.2\src\plugins\sqldrivers\mysql
    -> qmake "INCLUDEPATH +=c:\qt\mysql55\include" "LIBS +=c:\qt\mysql55\lib\libmysql.lib" mysql.pro
    -> make debug
    -> make release
    -> in debug folder, I got libqsqlmysqld4.a and qsqlmysqld4.dll
    -> in release folder, I got libqsqlmysql4.a and qsqlmysql4.dll
    -> copy these 4 files into C:\Qt\4.7.2\plugins\sqldrivers
    7. in c:\qt\mysql55\lib
    -> reimp -d libmysql.lib
    -> dlltool -k -d libmysql.def -l libmysql.a
    -> copy libmysql.dll into c:\qt\4.7.2\bin
    -> copy libmysql.a into c:\qt\4.7.2\lib

    Open a project to the check. QSqlDatabase::isDriverAvailable("QMYSQL") always returns false.
    What procedure is wrong for me? Please help!

  6. #5
    Join Date
    Aug 2009
    Location
    Greece
    Posts
    69
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL 5.5 plugin

    Hi SamT.
    Your step 7 should be before 6 so that the qmysql driver can be build with the mingw library

  7. The following user says thank you to Rhayader for this useful post:

    SamT (28th March 2011)

  8. #6
    Join Date
    Oct 2007
    Posts
    32
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MySQL 5.5 plugin

    Thanks Rhayader!
    After I re-build qmysql driver with mingw library. it works now!

  9. #7
    Join Date
    Mar 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: MySQL 5.5 plugin

    Hi folks

    I'm a bit desperate here, I rebuild QT 4.7.2 with VS2008 with the following parameters:

    configure -no-qt3support -platform win32-msvc2008 -qt-sql-mysql -plugin-sql-mysql -I C:\MySQL\include -L C:\MySQLßlib -l libmysql

    This compiles and buils just fine with nmake.

    The I try to build my code with the folloing .pro file:
    Qt Code:
    1. #! [0]
    2. TEMPLATE = app
    3. LANGUAGE = C++
    4. CONFIG += console
    5. QT += sql
    6.  
    7. QTPLUGIN += qsqlmysql
    8.  
    9. HEADERS = mainwindow.h \
    10. csv.h
    11. # myobject.h
    12.  
    13. SOURCES = main.cpp \
    14. mainwindow.cpp \
    15. csv.cpp
    16.  
    17. FORMS = ADBI.ui
    18.  
    19. #! [0]
    To copy to clipboard, switch view to plain text mode 

    My simple test code looks like this:

    Qt Code:
    1. #include <QtCore>
    2. #include <QApplication>
    3. #include <QtSql>
    4. #include <QSqlDatabase>
    5. #include <QtPlugin>
    6. #include "mainwindow.h"
    7.  
    8. Q_IMPORT_PLUGIN(qsqlmysql)
    9.  
    10.  
    11. int main(int argc, char **argv)
    12. {
    13. QCoreApplication app(argc, argv);
    14.  
    15. //QMainWindow *MW = new MainWindow();
    16.  
    17. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    18.  
    19. qDebug() << QApplication::libraryPaths();
    20. //qDebug() << QSqlDatabase::drivers();
    21.  
    22. //MW->show();
    23.  
    24. return app.exec();
    25. }
    To copy to clipboard, switch view to plain text mode 


    I now get the following linker error:

    1>main.obj : error LNK2019:can't find external Symbol ""class QObject * __cdecl qt_plugin_instance_qsqlmysql(void)" (?qt_plugin_instance_qsqlmysql@@YAPAVQObject@@XZ)" in Funktion ""public: __thiscall StaticqsqlmysqlPluginInstance::StaticqsqlmysqlPlug inInstance(void)" (??0StaticqsqlmysqlPluginInstance@@QAE@XZ)".


    If I comment out: Q_IMPORT_PLUGIN(qsqlmysql)

    it links just fine but then I get: DRIVER NOT LOADED.

    Any advice is very appreciated!

  10. #8
    Join Date
    Aug 2009
    Location
    Greece
    Posts
    69
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL 5.5 plugin

    The method you are using is for linking statically against your application but I don't think this is what you intended to do, so you should comment out the Q_IMPORT_PLUGIN and all.
    So some guesses:
    -I see you are using
    Qt Code:
    1. qDebug() << QApplication::libraryPaths();
    To copy to clipboard, switch view to plain text mode 
    in your app. Does this returns the app's directory and the QTDIR/plugins ? If not then you should set the QTDIR environment variable or follow some of the info of how the plugins are loading (in the qt docs http://doc.qt.nokia.com/4.7-snapshot...t-plugins.html)
    -Is the libmysql.dll in the path? (that was the reason I started this topic) If not copy it from the /MySQL/lib to /MyQSL/bin

  11. #9
    Join Date
    May 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: MySQL 5.5 plugin

    hi all,

    I'm currently trying to get the mysql driver with Qt 4.8.0 and MySQL Server 5.5.9 with no success...

    I've been following the steps described here: http://doc-snapshot.qt-project.org/4.8/sql-driver.html
    my qmake (here on Qt 4.8.2):
    Qt Code:
    1. c:\Qt\4.8.2\src\plugins\sqldrivers\mysql>qmake -o Makefile "INCLUDEPATH+=C:\\Progra~1\\MySQL\\MySQLS~1.5\\include" "LIBS+=C:\\Progra~1\\MySQL\\MYSQLS~1.5\\lib\\libmysql.lib" mysql.pro
    To copy to clipboard, switch view to plain text mode 

    I've been using short names to avoid spaces and I added backslashes to avoid the warning. Anyway, the compiler well find the headers (mysql.h).

    But no way, I always encouter the following errors when linking:

    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:362: undefined reference to `mysql_num_fields@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:369: undefined reference to `mysql_fetch_field@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:432: undefined reference to `mysql_free_result@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:438: undefined reference to `mysql_store_result@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:440: undefined reference to `mysql_free_result@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:437: undefined reference to `mysql_next_result@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:446: undefined reference to `mysql_stmt_close@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:452: undefined reference to `mysql_free_result@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:496: undefined reference to `mysql_stmt_data_seek@12'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:498: undefined reference to `mysql_stmt_fetch@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:513: undefined reference to `mysql_data_seek@12'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:514: undefined reference to `mysql_fetch_row@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:529: undefined reference to `mysql_stmt_fetch@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:544: undefined reference to `mysql_fetch_row@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:565: undefined reference to `mysql_stmt_num_rows@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:570: undefined reference to `mysql_num_rows@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:614: undefined reference to `mysql_fetch_lengths@4'
    debug/qsql_mysql.o:c:\Qt\4.8.2\src\plugins\sqldrivers\my sql/../../../sql/drivers/mysql/qsql_mysql.cpp:696: undefined reference to `mysql_real_query@12'
    etc.....

    my OS is Seven 32 bits, my SQL Server is 32 bits.

    Do you think I should try with Qt 4.7.2?? Or with an older version of SQL Server ? Problem is the MySQL servers I planned to target are 5.5 ones....
    Any idea? Thanks in advance for your help.

  12. #10
    Join Date
    May 2012
    Location
    Ahmedabad, Gujrat, India
    Posts
    3

    Default Re: MySQL 5.5 plugin

    Starting from MySQL 5.5.5, the default storage engine for new tables is InnoDB. This change applies to newly created tables that don’t specify a storage engine with a clause such as ENGINE=MyISAM. (Given this change of default behavior, MySQL 5.5 might be a logical point to evaluate whether your tables that do use MyISAM could benefit from switching to InnoDB.)

    The mysql and information_schema databases, that implement some of the MySQL internals, still use MyISAM. In particular, you cannot switch the grant tables to use InnoDB.

Similar Threads

  1. MySql Plugin again!
    By .:saeed:. in forum Newbie
    Replies: 4
    Last Post: 31st January 2011, 21:58
  2. MySql plugin on Mac OS X
    By tma in forum Installation and Deployment
    Replies: 1
    Last Post: 17th December 2010, 15:01
  3. plugin in mysql n qt
    By kazal in forum Qt Programming
    Replies: 10
    Last Post: 24th June 2010, 11:02
  4. after plugin Mysql n Qt..??
    By kazal in forum Newbie
    Replies: 0
    Last Post: 23rd June 2010, 09:44
  5. MySQL plugin
    By ksqt in forum Installation and Deployment
    Replies: 12
    Last Post: 24th September 2009, 13:26

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
  •  
Qt is a trademark of The Qt Company.