Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Driver not loaded (MySQL)
Qt 6.11 is out! See what's new in the release blog

Driver not loaded (MySQL)

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 1.0k 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.
  • ocgltdO Offline
    ocgltdO Offline
    ocgltd
    wrote on last edited by ocgltd
    #1

    When I run my app (from Qt Creator 5.15.2) on Ubutu 23, my code reports the database error "Driver not loaded". I assumed it was that the MySQL plugin was not found, so I built it per other posts. It actually looked like it was already built, but I built it anyways.

    Next I checked my apps' dependencies:

    ldd /myapp
            linux-vdso.so.1 (0x00007fff89592000)
            libQt5Network.so.5 => /opt/Qt/5.15.2/gcc_64/lib/libQt5Network.so.5 (0x00007f6c23e00000)
            libQt5Xml.so.5 => /opt/Qt/5.15.2/gcc_64/lib/libQt5Xml.so.5 (0x00007f6c23a00000)
            libQt5Sql.so.5 => /opt/Qt/5.15.2/gcc_64/lib/libQt5Sql.so.5 (0x00007f6c23600000)
            libQt5Core.so.5 => /opt/Qt/5.15.2/gcc_64/lib/libQt5Core.so.5 (0x00007f6c22e00000)
            libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6c22a00000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6c2427b000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6c22600000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6c24276000)
            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6c24258000)
            libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6c24253000)
            libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f6c241ff000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6c23d17000)
            libicui18n.so.56 => /opt/Qt/5.15.2/gcc_64/lib/libicui18n.so.56 (0x00007f6c22000000)
            libicuuc.so.56 => /opt/Qt/5.15.2/gcc_64/lib/libicuuc.so.56 (0x00007f6c21c00000)
            libicudata.so.56 => /opt/Qt/5.15.2/gcc_64/lib/libicudata.so.56 (0x00007f6c20200000)
            libgthread-2.0.so.0 => /lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f6c241f8000)
            libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f6c238b9000)
            /lib64/ld-linux-x86-64.so.2 (0x00007f6c242b8000)
            libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f6c23c4e000)
            libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f6c241ca000)
            libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f6c241c4000)
            libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f6c241b7000)
            libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f6c22d66000)
            libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f6c241ae000)
            libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f6c238a6000)
    

    When I show the output of QSqlDatabase::drivers() I see:
    ("QSQLITE", "QMARIADB", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3", "QPSQL", "QPSQL7")

    so I think the driver is there, and according to ldd all libraries are found. Yet the error continues. How do I solve this?

    My code (which worked fine on my old dev box) is:

    driver="QMYSQL";
    m_db = new QSqlDatabase();
     *m_db = QSqlDatabase::addDatabase(driver,QUuid::createUuid().toString());  // Create connection with unique name each time
     m_db->setHostName(programSettings->database_hostname());
     m_db->setDatabaseName(programSettings->database_databasename());
     m_db->setUserName(programSettings->database_username());
     m_db->setPassword(programSettings->database_password());
    
    Christian EhrlicherC 1 Reply Last reply
    0
    • ocgltdO ocgltd

      @Christian-Ehrlicher Here is full output :

      QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers" ...
      QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so"
      Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QSQLITE"
              ]
          },
          "archreq": 0,
          "className": "QSQLiteDriverPlugin",
          "debug": false,
          "version": 331520
      }
      
      
      Got keys from plugin meta data ("QSQLITE")
      QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so.debug"
      "The shared library was not found." 
               not a plugin
      QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
      Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QMYSQL3",
                  "QMYSQL",
                  "QMARIADB"
              ]
          },
          "archreq": 0,
          "className": "QMYSQLDriverPlugin",
          "debug": false,
          "version": 331520
      }
      
      
      Got keys from plugin meta data ("QMYSQL3", "QMYSQL", "QMARIADB")
      QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so.debug"
      "The shared library was not found." 
               not a plugin
      QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so"
      Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QODBC3",
                  "QODBC"
              ]
          },
          "archreq": 0,
          "className": "QODBCDriverPlugin",
          "debug": false,
          "version": 331520
      }
      
      
      Got keys from plugin meta data ("QODBC3", "QODBC")
      QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so.debug"
      "The shared library was not found." 
               not a plugin
      QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so"
      Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QPSQL7",
                  "QPSQL"
              ]
          },
          "archreq": 0,
          "className": "QPSQLDriverPlugin",
          "debug": false,
          "version": 331520
      }
      
      
      Got keys from plugin meta data ("QPSQL7", "QPSQL")
      QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so.debug"
      "The shared library was not found." 
               not a plugin
      QFactoryLoader::QFactoryLoader() checking directory path "/mnt/lserver/data/development/licensecreator/bin/debug/sqldrivers" ...
      loaded library "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
      

      And here is the content of /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/

      drwxr-xr-x  2 root root    4096 Aug 14 21:09 ./
      drwxr-xr-x 36 root root    4096 Nov  6  2020 ../
      -rwxr-xr-x  1 root root 1476256 Aug 14 21:08 libqsqlite.so*
      -rw-r--r--  1 root root 6334248 Aug 14 21:08 libqsqlite.so.debug
      -rwxr-xr-x  1 root root  111248 Aug 14 21:06 libqsqlmysql.so*
      -rwxrwxrwx  1 root root 1319264 Aug 14 21:06 libqsqlmysql.so.debug*
      -rwxr-xr-x  1 root root  119360 Nov  6  2020 libqsqlodbc.so*
      -rw-r--r--  1 root root 1204520 Nov  6  2020 libqsqlodbc.so.debug
      -rwxr-xr-x  1 root root  115032 Nov  6  2020 libqsqlpsql.so*
      -rw-r--r--  1 root root 1292544 Nov  6  2020 libqsqlpsql.so.debug
      

      A little more info...my call to m_db->open() succeeds and then I perform a query. I see the prepare fails with:

      QSqlQuery::prepare: database not open
      

      I'm not sure if that is the cause, a symptom, or irrelevant. Why would the db not be open...perhaps the driver error?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #7

      @ocgltd said in Driver not loaded (MySQL):

      Why would the db not be open...perhaps the driver error?

      No, for sure not. You did something wrong. But without a minimal, compilable example we can not say what.

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

      ocgltdO 1 Reply Last reply
      0
      • ocgltdO ocgltd

        When I run my app (from Qt Creator 5.15.2) on Ubutu 23, my code reports the database error "Driver not loaded". I assumed it was that the MySQL plugin was not found, so I built it per other posts. It actually looked like it was already built, but I built it anyways.

        Next I checked my apps' dependencies:

        ldd /myapp
                linux-vdso.so.1 (0x00007fff89592000)
                libQt5Network.so.5 => /opt/Qt/5.15.2/gcc_64/lib/libQt5Network.so.5 (0x00007f6c23e00000)
                libQt5Xml.so.5 => /opt/Qt/5.15.2/gcc_64/lib/libQt5Xml.so.5 (0x00007f6c23a00000)
                libQt5Sql.so.5 => /opt/Qt/5.15.2/gcc_64/lib/libQt5Sql.so.5 (0x00007f6c23600000)
                libQt5Core.so.5 => /opt/Qt/5.15.2/gcc_64/lib/libQt5Core.so.5 (0x00007f6c22e00000)
                libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6c22a00000)
                libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6c2427b000)
                libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6c22600000)
                libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6c24276000)
                libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6c24258000)
                libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6c24253000)
                libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f6c241ff000)
                libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6c23d17000)
                libicui18n.so.56 => /opt/Qt/5.15.2/gcc_64/lib/libicui18n.so.56 (0x00007f6c22000000)
                libicuuc.so.56 => /opt/Qt/5.15.2/gcc_64/lib/libicuuc.so.56 (0x00007f6c21c00000)
                libicudata.so.56 => /opt/Qt/5.15.2/gcc_64/lib/libicudata.so.56 (0x00007f6c20200000)
                libgthread-2.0.so.0 => /lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f6c241f8000)
                libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f6c238b9000)
                /lib64/ld-linux-x86-64.so.2 (0x00007f6c242b8000)
                libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f6c23c4e000)
                libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f6c241ca000)
                libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f6c241c4000)
                libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f6c241b7000)
                libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f6c22d66000)
                libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f6c241ae000)
                libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f6c238a6000)
        

        When I show the output of QSqlDatabase::drivers() I see:
        ("QSQLITE", "QMARIADB", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3", "QPSQL", "QPSQL7")

        so I think the driver is there, and according to ldd all libraries are found. Yet the error continues. How do I solve this?

        My code (which worked fine on my old dev box) is:

        driver="QMYSQL";
        m_db = new QSqlDatabase();
         *m_db = QSqlDatabase::addDatabase(driver,QUuid::createUuid().toString());  // Create connection with unique name each time
         m_db->setHostName(programSettings->database_hostname());
         m_db->setDatabaseName(programSettings->database_databasename());
         m_db->setUserName(programSettings->database_username());
         m_db->setPassword(programSettings->database_password());
        
        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @ocgltd Start your app with the env var QT_DEBUG_PLUGINS and take a look at the console output.

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

        ocgltdO 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @ocgltd Start your app with the env var QT_DEBUG_PLUGINS and take a look at the console output.

          ocgltdO Offline
          ocgltdO Offline
          ocgltd
          wrote on last edited by ocgltd
          #3

          I got interesting output...the file /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so exists, and has 777permissions:

          QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
          Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so, metadata=
          {
              "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
              "MetaData": {
                  "Keys": [
                      "QMYSQL3",
                      "QMYSQL",
                      "QMARIADB"
                  ]
              },
              "archreq": 0,
              "className": "QMYSQLDriverPlugin",
              "debug": false,
              "version": 331520
          }
          
          Christian EhrlicherC 1 Reply Last reply
          0
          • ocgltdO ocgltd

            I got interesting output...the file /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so exists, and has 777permissions:

            QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
            Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so, metadata=
            {
                "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                "MetaData": {
                    "Keys": [
                        "QMYSQL3",
                        "QMYSQL",
                        "QMARIADB"
                    ]
                },
                "archreq": 0,
                "className": "QMYSQLDriverPlugin",
                "debug": false,
                "version": 331520
            }
            
            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Please post the full output. The debug file does not matter.

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

            ocgltdO 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              Please post the full output. The debug file does not matter.

              ocgltdO Offline
              ocgltdO Offline
              ocgltd
              wrote on last edited by ocgltd
              #5

              @Christian-Ehrlicher Here is full output :

              QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers" ...
              QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so"
              Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so, metadata=
              {
                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                  "MetaData": {
                      "Keys": [
                          "QSQLITE"
                      ]
                  },
                  "archreq": 0,
                  "className": "QSQLiteDriverPlugin",
                  "debug": false,
                  "version": 331520
              }
              
              
              Got keys from plugin meta data ("QSQLITE")
              QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so.debug"
              "The shared library was not found." 
                       not a plugin
              QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
              Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so, metadata=
              {
                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                  "MetaData": {
                      "Keys": [
                          "QMYSQL3",
                          "QMYSQL",
                          "QMARIADB"
                      ]
                  },
                  "archreq": 0,
                  "className": "QMYSQLDriverPlugin",
                  "debug": false,
                  "version": 331520
              }
              
              
              Got keys from plugin meta data ("QMYSQL3", "QMYSQL", "QMARIADB")
              QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so.debug"
              "The shared library was not found." 
                       not a plugin
              QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so"
              Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so, metadata=
              {
                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                  "MetaData": {
                      "Keys": [
                          "QODBC3",
                          "QODBC"
                      ]
                  },
                  "archreq": 0,
                  "className": "QODBCDriverPlugin",
                  "debug": false,
                  "version": 331520
              }
              
              
              Got keys from plugin meta data ("QODBC3", "QODBC")
              QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so.debug"
              "The shared library was not found." 
                       not a plugin
              QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so"
              Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so, metadata=
              {
                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                  "MetaData": {
                      "Keys": [
                          "QPSQL7",
                          "QPSQL"
                      ]
                  },
                  "archreq": 0,
                  "className": "QPSQLDriverPlugin",
                  "debug": false,
                  "version": 331520
              }
              
              
              Got keys from plugin meta data ("QPSQL7", "QPSQL")
              QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so.debug"
              "The shared library was not found." 
                       not a plugin
              QFactoryLoader::QFactoryLoader() checking directory path "/mnt/lserver/data/development/licensecreator/bin/debug/sqldrivers" ...
              loaded library "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
              

              And here is the content of /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/

              drwxr-xr-x  2 root root    4096 Aug 14 21:09 ./
              drwxr-xr-x 36 root root    4096 Nov  6  2020 ../
              -rwxr-xr-x  1 root root 1476256 Aug 14 21:08 libqsqlite.so*
              -rw-r--r--  1 root root 6334248 Aug 14 21:08 libqsqlite.so.debug
              -rwxr-xr-x  1 root root  111248 Aug 14 21:06 libqsqlmysql.so*
              -rwxrwxrwx  1 root root 1319264 Aug 14 21:06 libqsqlmysql.so.debug*
              -rwxr-xr-x  1 root root  119360 Nov  6  2020 libqsqlodbc.so*
              -rw-r--r--  1 root root 1204520 Nov  6  2020 libqsqlodbc.so.debug
              -rwxr-xr-x  1 root root  115032 Nov  6  2020 libqsqlpsql.so*
              -rw-r--r--  1 root root 1292544 Nov  6  2020 libqsqlpsql.so.debug
              

              A little more info...my call to m_db->open() succeeds and then I perform a query. I see the prepare fails with:

              QSqlQuery::prepare: database not open
              

              I'm not sure if that is the cause, a symptom, or irrelevant. Why would the db not be open...perhaps the driver error?

              Christian EhrlicherC 2 Replies Last reply
              0
              • ocgltdO ocgltd

                @Christian-Ehrlicher Here is full output :

                QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers" ...
                QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so"
                Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so, metadata=
                {
                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                    "MetaData": {
                        "Keys": [
                            "QSQLITE"
                        ]
                    },
                    "archreq": 0,
                    "className": "QSQLiteDriverPlugin",
                    "debug": false,
                    "version": 331520
                }
                
                
                Got keys from plugin meta data ("QSQLITE")
                QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so.debug"
                "The shared library was not found." 
                         not a plugin
                QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
                Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so, metadata=
                {
                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                    "MetaData": {
                        "Keys": [
                            "QMYSQL3",
                            "QMYSQL",
                            "QMARIADB"
                        ]
                    },
                    "archreq": 0,
                    "className": "QMYSQLDriverPlugin",
                    "debug": false,
                    "version": 331520
                }
                
                
                Got keys from plugin meta data ("QMYSQL3", "QMYSQL", "QMARIADB")
                QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so.debug"
                "The shared library was not found." 
                         not a plugin
                QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so"
                Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so, metadata=
                {
                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                    "MetaData": {
                        "Keys": [
                            "QODBC3",
                            "QODBC"
                        ]
                    },
                    "archreq": 0,
                    "className": "QODBCDriverPlugin",
                    "debug": false,
                    "version": 331520
                }
                
                
                Got keys from plugin meta data ("QODBC3", "QODBC")
                QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so.debug"
                "The shared library was not found." 
                         not a plugin
                QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so"
                Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so, metadata=
                {
                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                    "MetaData": {
                        "Keys": [
                            "QPSQL7",
                            "QPSQL"
                        ]
                    },
                    "archreq": 0,
                    "className": "QPSQLDriverPlugin",
                    "debug": false,
                    "version": 331520
                }
                
                
                Got keys from plugin meta data ("QPSQL7", "QPSQL")
                QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so.debug"
                "The shared library was not found." 
                         not a plugin
                QFactoryLoader::QFactoryLoader() checking directory path "/mnt/lserver/data/development/licensecreator/bin/debug/sqldrivers" ...
                loaded library "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
                

                And here is the content of /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/

                drwxr-xr-x  2 root root    4096 Aug 14 21:09 ./
                drwxr-xr-x 36 root root    4096 Nov  6  2020 ../
                -rwxr-xr-x  1 root root 1476256 Aug 14 21:08 libqsqlite.so*
                -rw-r--r--  1 root root 6334248 Aug 14 21:08 libqsqlite.so.debug
                -rwxr-xr-x  1 root root  111248 Aug 14 21:06 libqsqlmysql.so*
                -rwxrwxrwx  1 root root 1319264 Aug 14 21:06 libqsqlmysql.so.debug*
                -rwxr-xr-x  1 root root  119360 Nov  6  2020 libqsqlodbc.so*
                -rw-r--r--  1 root root 1204520 Nov  6  2020 libqsqlodbc.so.debug
                -rwxr-xr-x  1 root root  115032 Nov  6  2020 libqsqlpsql.so*
                -rw-r--r--  1 root root 1292544 Nov  6  2020 libqsqlpsql.so.debug
                

                A little more info...my call to m_db->open() succeeds and then I perform a query. I see the prepare fails with:

                QSqlQuery::prepare: database not open
                

                I'm not sure if that is the cause, a symptom, or irrelevant. Why would the db not be open...perhaps the driver error?

                Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #6

                The output shows that the plugin gets properly loaded (if this was really the complete output).

                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
                0
                • ocgltdO ocgltd

                  @Christian-Ehrlicher Here is full output :

                  QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers" ...
                  QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so"
                  Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so, metadata=
                  {
                      "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                      "MetaData": {
                          "Keys": [
                              "QSQLITE"
                          ]
                      },
                      "archreq": 0,
                      "className": "QSQLiteDriverPlugin",
                      "debug": false,
                      "version": 331520
                  }
                  
                  
                  Got keys from plugin meta data ("QSQLITE")
                  QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so.debug"
                  "The shared library was not found." 
                           not a plugin
                  QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
                  Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so, metadata=
                  {
                      "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                      "MetaData": {
                          "Keys": [
                              "QMYSQL3",
                              "QMYSQL",
                              "QMARIADB"
                          ]
                      },
                      "archreq": 0,
                      "className": "QMYSQLDriverPlugin",
                      "debug": false,
                      "version": 331520
                  }
                  
                  
                  Got keys from plugin meta data ("QMYSQL3", "QMYSQL", "QMARIADB")
                  QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so.debug"
                  "The shared library was not found." 
                           not a plugin
                  QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so"
                  Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so, metadata=
                  {
                      "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                      "MetaData": {
                          "Keys": [
                              "QODBC3",
                              "QODBC"
                          ]
                      },
                      "archreq": 0,
                      "className": "QODBCDriverPlugin",
                      "debug": false,
                      "version": 331520
                  }
                  
                  
                  Got keys from plugin meta data ("QODBC3", "QODBC")
                  QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so.debug"
                  "The shared library was not found." 
                           not a plugin
                  QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so"
                  Found metadata in lib /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so, metadata=
                  {
                      "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                      "MetaData": {
                          "Keys": [
                              "QPSQL7",
                              "QPSQL"
                          ]
                      },
                      "archreq": 0,
                      "className": "QPSQLDriverPlugin",
                      "debug": false,
                      "version": 331520
                  }
                  
                  
                  Got keys from plugin meta data ("QPSQL7", "QPSQL")
                  QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so.debug"
                  "The shared library was not found." 
                           not a plugin
                  QFactoryLoader::QFactoryLoader() checking directory path "/mnt/lserver/data/development/licensecreator/bin/debug/sqldrivers" ...
                  loaded library "/opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlmysql.so"
                  

                  And here is the content of /opt/Qt/5.15.2/gcc_64/plugins/sqldrivers/

                  drwxr-xr-x  2 root root    4096 Aug 14 21:09 ./
                  drwxr-xr-x 36 root root    4096 Nov  6  2020 ../
                  -rwxr-xr-x  1 root root 1476256 Aug 14 21:08 libqsqlite.so*
                  -rw-r--r--  1 root root 6334248 Aug 14 21:08 libqsqlite.so.debug
                  -rwxr-xr-x  1 root root  111248 Aug 14 21:06 libqsqlmysql.so*
                  -rwxrwxrwx  1 root root 1319264 Aug 14 21:06 libqsqlmysql.so.debug*
                  -rwxr-xr-x  1 root root  119360 Nov  6  2020 libqsqlodbc.so*
                  -rw-r--r--  1 root root 1204520 Nov  6  2020 libqsqlodbc.so.debug
                  -rwxr-xr-x  1 root root  115032 Nov  6  2020 libqsqlpsql.so*
                  -rw-r--r--  1 root root 1292544 Nov  6  2020 libqsqlpsql.so.debug
                  

                  A little more info...my call to m_db->open() succeeds and then I perform a query. I see the prepare fails with:

                  QSqlQuery::prepare: database not open
                  

                  I'm not sure if that is the cause, a symptom, or irrelevant. Why would the db not be open...perhaps the driver error?

                  Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  @ocgltd said in Driver not loaded (MySQL):

                  Why would the db not be open...perhaps the driver error?

                  No, for sure not. You did something wrong. But without a minimal, compilable example we can not say what.

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

                  ocgltdO 1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    @ocgltd said in Driver not loaded (MySQL):

                    Why would the db not be open...perhaps the driver error?

                    No, for sure not. You did something wrong. But without a minimal, compilable example we can not say what.

                    ocgltdO Offline
                    ocgltdO Offline
                    ocgltd
                    wrote on last edited by
                    #8

                    @Christian-Ehrlicher In building my MRE I found a mistake I hadn't noticed before...solved :)

                    Thanks

                    1 Reply Last reply
                    2
                    • ocgltdO ocgltd has marked this topic as solved on

                    • Login

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