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

SQL Driver

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 5 Posters 8.3k Views 1 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.
  • S Offline
    S Offline
    SimonJudge
    wrote on last edited by
    #1

    I have a QML app run using the QMLViewer. When I try to use the QML db API (openDatabaseSync) I got the error...

    QSqlDatabase: QMYSQL driver not loaded

    I found the following page http://doc.qt.nokia.com/4.7/sql-driver.html#building-the-plugins-manually
    After some time, I managed to download MySQL and the developer include/library
    I successfully built and installed the QMYSQL library

    Now when I run the app it says...

    QSqlDatabase: QSQLITE driver not loaded
    QSqlDatabase: available drivers: QMYSQL3 QMYSQL
    QSQLITE driver not loaded

    Where do I set the app to use the correct plugin?

    Thanks

    Simon

    1 Reply Last reply
    0
    • I Offline
      I Offline
      Immii
      wrote on last edited by
      #2

      Do you see your drivers build in Qt's plugins folder??

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SimonJudge
        wrote on last edited by
        #3

        I had libqsqlite.so, libqsqlite2.so and libqsqlpsql.so in the qt/plugins/sqldrivers dir... all with old dates

        The src/plugins/sqldrivers had my newly built library libqsqlmysql.so so I have now copied this to qt/plugins/sqldrivers and did a make install that output...

        install -m 755 -p "libqsqlmysql.so" "/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql.so"

        ...but I still get the app error saying "QSQLITE driver not loaded"

        Simon

        1 Reply Last reply
        0
        • M Offline
          M Offline
          maciej
          wrote on last edited by
          #4

          MySQL plugin is working. It seems that installing qmysql messed something with sqlite plugin. Can you provide some more info about your system (which distro, qt installed from package or source)? Maybe recompiling "qsqlite plugin":http://doc.qt.nokia.com/4.7/sql-driver.html#how-to-build-the-qsqlite-plugin will help?

          Earth is a beta site.

          1 Reply Last reply
          0
          • V Offline
            V Offline
            vsorokin
            wrote on last edited by
            #5

            I didn't understand, do you need qmysql or qsqlite? qmysql plugin is working: QSqlDatabase: available drivers: QMYSQL3 QMYSQL
            qsqlite is not: QSQLITE driver not loaded

            --
            Vasiliy

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SimonJudge
              wrote on last edited by
              #6

              Let's go back to the original question...

              Where do I set the app (or Qt) to use the correct plugin?

              Thanks

              Simon

              1 Reply Last reply
              0
              • M Offline
                M Offline
                maciej
                wrote on last edited by
                #7

                You should add
                @
                QT += sql
                @ in your .pro file
                then in code you're using:
                @
                QSqlDatabase db;
                //...
                db = QSqlDatabase::addDatabase("QMYSQL");
                @

                Earth is a beta site.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  I usually put the SQL plugin in a directory called "sqldrivers", and place that directory in the same directory as the executable.

                  Note that you must use the same version as your Qt libs, including debug or release version. Otherwise, the plugin will not load. It can help to change your Run Settings (from the Projects tab) and add QT_DEBUG_PLUGINS = 1 to your Run Environment. That will generate debug output for the loading of Qt plugins.

                  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