QT Creator 5.1 and MYSQL Windows7



  • Hello all
    this is my first topic here and I'm feeling excited to join the community....

    I'm new to QT and recently downloaded QT Creator 5.1.0 for windows 7 from the download page...

    It came with no source packages and no SDK package management....

    any way I managed to get the mysql source from the internet and compiled it using the includepath and libs arguments and managed to get 4 files....

    1- libqsqlmysql4.a
    2- libqsqlmysqld4.a
    3- qsqlmysql4.dll
    4- qsqlmysqld4.dll

    now what should I do with these files in order to develop a database application connects to mysql server database???

    I hope the topic is clear and excuse me for my bad English...

    Mohammed...


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    The QtCreator package is only for QtCreator. The Qt 5.1 installers proposes QtCreator has well as the libraries pre-compiled.

    To get on the sql track, have look at the "QtSql module":http://qt-project.org/doc/qt-5.1/qtsql/qtsql-index.html and "Sql Programming":http://qt-project.org/doc/qt-5.1/qtsql/sql-programming.html documents

    You can also play with the examples and demos provided with Qt



  • Thanks for your reply and your welcome :)

    Maybe my question was not clear

    I don't want to know how to develop mysql using QT

    I just want to enable the mysql driver plugin in my QT

    so what should I do with the files I mentioned before to enable the mysql driver plugin????


  • Lifetime Qt Champion

    Since they are built, they should already be in the right place. So you just have to tell QDataBase that you want to use QMYSQL and voilà !

    Just don't forget to have the mysql dll path in your PATH otherwise the plugin will fail to load.



  • When I run my app and try to Excecute my code
    @QSqlDatabase db= QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("127.0.0.1");
    db.setDatabaseName("olcasheir");
    db.setUserName("root");
    db.setPassword("*****");
    if(!db.open())@

    I get the output

    @QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7@

    THER IS NO MYSQL DRIVE INSTALLED !!!


  • Lifetime Qt Champion

    No need to get all uppercase,

    check the content of the plugins subfolder in your Qt installation, if the dlls are there, check that their dependencies can be found. If not, copy the dlls there and retry


Log in to reply
 

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