Results 1 to 8 of 8

Thread: How to use static mysql plugin

Hybrid View

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

    Default Re: How to use static mysql plugin

    Do you have those static plugins built?

  2. #2
    Join Date
    Jan 2009
    Posts
    8
    Thanks
    1

    Default Re: How to use static mysql plugin

    hey thanks for replying,

    I do have the -qt-sql-mysql driver and plugin specified. all seems correct.

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

    Default Re: How to use static mysql plugin

    I'm asking if the static plugin file is the sqldrivers directory. BTW. -qt-sql-mysql and -plugin-sql-mysql are exclusive. The first compiles mysql support directly into Qt library whereas the second one builds a static plugin. Please check if any of your Qt libraries depends on the mysql client library.

  4. #4
    Join Date
    Jan 2009
    Posts
    8
    Thanks
    1

    Default Re: How to use static mysql plugin

    ah, sorry about that,

    according to the documentation, it seems that I do. I have the libqsqlmysql.a in the plugin/sqldrivers directory.

  5. #5
    Join Date
    Jan 2009
    Posts
    8
    Thanks
    1

    Default Re: How to use static mysql plugin

    Being a newbies I don't know how to check if any library depends on mysqlclient. after reading other forum, I assume that it does, other suggested to include -L/usr/lib/mysql -lmysqlclient

    after doing that, I have a different error:
    " /usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.so when searching for -lmysqlclient
    /usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient
    /usr/bin/ld: cannot find -lmysqlclient"

    I checked and there exist under /usr/lib/sql both the libmysqlclient.so and .a

    this stuff is beyond my knowledge, I hope you can help.

    thanks

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

    Default Re: How to use static mysql plugin

    Run ldd on every Qt library (QtCore and QtSql being the most obvious ones) and see if "libmysqlclient" is there.

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

    khikho (19th January 2009)

  8. #7
    Join Date
    Jan 2009
    Posts
    8
    Thanks
    1

    Talking Re: How to use static mysql plugin

    I finally figured this out, for future user, here is correct way to do this step by step:

    How to use static plugin in qt: example for mysql

    1) ./configure -static -plugin-sql-mysql ... and many other switch as you wish,

    2) make sure your project file look as follow:

    Template = app
    TARGET = executable
    QT += core sql
    CONFIG += static
    QTPLUGIN += qsqlmysql
    LIBS += -L/usr/lib64/mysql -lmysqlclient ( use /usr/lib/mysql for 32 bit system )
    source += main.cpp


    3) make sure your file have the macro that look as followed:

    #include <QtCore>
    #include <QSqlDatabase>
    #include <QtPlugin>

    QT_IMPORT_PLUGIN( qsqlmysql )

    int main( int argc, char** argv )
    {
    QCoreApplication app( argc, argc );

    QSqlDatabase db = QSqlDatabase::addDatabase( "MYSQL" );
    qDebug() << QSqlDatabase::drivers();


    return 0;
    }


    This will give you a working example to push ahead.



    4) for using mysql driver as share object, just recompile qt as follow
    ./configure -qt-sql-mysql ... and many other switch

    5) use QSqlDatabase as in step 3 without the PLUGIN macro.
    Last edited by khikho; 19th January 2009 at 23:05.

Similar Threads

  1. How build mysql plugin
    By MrShahi in forum Installation and Deployment
    Replies: 5
    Last Post: 8th June 2008, 00:11
  2. Replies: 16
    Last Post: 23rd May 2008, 10:12
  3. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13
  4. Qt4 win opensource + mysql plugin
    By vr in forum Installation and Deployment
    Replies: 3
    Last Post: 25th May 2007, 09:01
  5. MySql plugin driver issues
    By stevey in forum Installation and Deployment
    Replies: 11
    Last Post: 20th September 2006, 13:45

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.