Which database driver should I choose to connect to GearHost Server

  • I would like to connect to database hosted by gearhost.com. The database has been designed using MySQL language. In my mac, I haven't installed MySQL however, the driver for the Qt is installed. My question is is installing MySQL necessary? How can I design an application where the users of the application should not worry about installing extra driver in order to use the application? At this moment, running the following script

        qDebug()  <<  QSqlDatabase::drivers();
        QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
        db.setDatabaseName("xxxxxx"); //<-- I have the real data
        db.setUserName("xxxxxx"); //<-- I have the real data
        db.setPassword("xxxxxx"); //<-- I have the real data
        bool ok = db.open();
        qDebug() << ok;

    The output is

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

    Choosing QSQLITE, the connection is always true even if I turn off the Internet connection. Obviously, there is something incorrect.

  • @CroCo

    Under windows you need a dll which you have to get separately from MySql webpage. For windows these are 2 libraries (the lib-stumpand the dll) to be correct.
    IIRC you can compile, link and run your application without, but you cannot connect.

    Hope this helps.

Log in to reply

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