Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MariaDB
Forum Updated to NodeBB v4.3 + New Features

MariaDB

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • transistor47T Offline
    transistor47T Offline
    transistor47
    wrote on last edited by
    #1

    Hello everybody,
    I have downloaded MariaDB Connector C/C++ but does not work
    Is there anybody or a tutorial to learn how install MariaDB connector?
    I use Ubuntu 18.04 desktop
    Thank you!

    1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #2

      Isn't MariaDB compatible with MySQLDB? Just use standard mysql Qt objects. Or do you need things that mariadb has the mysql does not?
      https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility/

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      2
      • transistor47T Offline
        transistor47T Offline
        transistor47
        wrote on last edited by
        #3

        When I run my code appears:

        QSqlDatabase: QMYSQL driver not loaded
        QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
        Failed to connect.

        My code is:

        #include <QCoreApplication>
        #include <QtSql>
        #include <QSqlDatabase>
        #include <QSqlQuery>
        #include <QDebug>

        *int main(int argc, char argv[])
        {
        QCoreApplication a(argc, argv);
        QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
        db.setHostName("127.0.0.1");
        db.setPort(3306);
        db.setDatabaseName("test");
        db.setUserName("usuario");
        db.setPassword("usuario");
        if (db.open())
        {
        qDebug() << "Connected!";
        }
        else
        {
        qDebug() << "Failed to connect.";
        return 0;
        }
        return a.exec();
        }

        What connector do you recommend?

        Thank you

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @transistor47 said in MariaDB:

          QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

          As you can see there is no QMYSQL driver available. You have to compile it by your own (or, if you use the Qt from your distribution, install the qmysql package)

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • fcarneyF Offline
            fcarneyF Offline
            fcarney
            wrote on last edited by
            #5

            Hmmm... sorry, I made some assumptions:
            https://doc.qt.io/qt-5/sql-driver.html

            C++ is a perfectly valid school of magic.

            1 Reply Last reply
            0
            • transistor47T Offline
              transistor47T Offline
              transistor47
              wrote on last edited by
              #6

              **

              • Thank you!!!**
              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved