Results 1 to 10 of 10

Thread: MySQL 5.5 plugin

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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!

  2. #2
    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

  3. #3
    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.

  4. #4
    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.