MySql with Qt SDK 1.1 in Windows XP



  • Hi everyone,

    I am started Qt a couple of weeks ago.
    I am using windows XP and I want to use mysql with Qt. Can anyone please tell me step by step guide so that I can know how to use mysql with qt? I have searched alot about this but failed to use it. I am using Qt SDK 1.1.

    Thanks in advance for any help..

    Regards,
    Khalid Mushtaq



  • Hi Khalid,
    the difficult part is to build the QMYSQL plugin. Johan Thelin provided a good description for it.
    http://www.qtcentre.org/wiki/index.php?title=Building_the_QMYSQL_plugin_on_Windows_using_MinGW
    Once you have built the plugin using MySql with Qt should work like a charm.
    Taken from QSqlDatabase documentation:

    @
    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("acidalia");
    db.setDatabaseName("customdb");
    db.setUserName("mojito");
    db.setPassword("J0a1m8");
    bool ok = db.open();
    @

    Not meaning to start a flawmewar but please consider that the mysql driver is GPL which makes your app also GPL unless you pay for it. I am in the process of converting my database from MySql to PostgreSQL because of features, Oracles reputation and license.
    Have Fun
    Roland

    [EDIT: code formatting, pleas use @-tags, Volker]


Log in to reply
 

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