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. QSqlDatabase "Driver not loaded" 🤔🤨
QtWS25 Last Chance

QSqlDatabase "Driver not loaded" 🤔🤨

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 6 Posters 895 Views
  • 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.
  • C Offline
    C Offline
    CodeBroker
    wrote on 13 Mar 2024, 11:13 last edited by
    #1

    Hello

    Short story: Trying to get MySQL to work with Qt. I have been struggling with this for over a day, and I have scraped the whole world wide web for a solution.

    Qt Version = 6.6.2
    Compiler = MinGW 64 11.2.0

    I have compiled the QMYSQL driver from source.

    QT_DEBUG_PLUGINS yields this:

    qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.6.2/mingw_64/plugins/platforms" ...
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/platforms/qdirect2d.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/platforms/qdirect2d.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "direct2d"
            ]
        },
        "archlevel": 2,
        "className": "QWindowsDirect2DIntegrationPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("direct2d")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/platforms/qminimal.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/platforms/qminimal.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "archlevel": 2,
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/platforms/qoffscreen.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/platforms/qoffscreen.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "archlevel": 2,
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/platforms/qwindows.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/platforms/qwindows.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "windows"
            ]
        },
        "archlevel": 2,
        "className": "QWindowsIntegrationPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("windows")
    qt.core.plugin.factoryloader: checking directory path "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/platforms" ...
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/platforms/qwindows.dll" loaded library
    qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.6.2/mingw_64/plugins/platformthemes" ...
    qt.core.plugin.factoryloader: checking directory path "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/platformthemes" ...
    qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers" ...
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlite.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlite.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QSQLITE"
            ]
        },
        "archlevel": 2,
        "className": "QSQLiteDriverPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmimer.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmimer.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QMIMER"
            ]
        },
        "archlevel": 2,
        "className": "QMimerSQLDriverPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMIMER")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmysql.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QMYSQL",
                "QMARIADB"
            ]
        },
        "archlevel": 2,
        "className": "QMYSQLDriverPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlodbc.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QODBC"
            ]
        },
        "archlevel": 2,
        "className": "QODBCDriverPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QODBC")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlpsql.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QPSQL"
            ]
        },
        "archlevel": 2,
        "className": "QPSQLDriverPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
    qt.core.plugin.factoryloader: checking directory path "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers" ...
    qt.core.plugin.factoryloader: looking at "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlite.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlite.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QSQLITE"
            ]
        },
        "archlevel": 2,
        "className": "QSQLiteDriverPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
    qt.core.plugin.factoryloader: looking at "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlmimer.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlmimer.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QMIMER"
            ]
        },
        "archlevel": 2,
        "className": "QMimerSQLDriverPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMIMER")
    qt.core.plugin.factoryloader: looking at "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlmysql.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlmysql.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QMYSQL",
                "QMARIADB"
            ]
        },
        "archlevel": 2,
        "className": "QMYSQLDriverPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB")
    qt.core.plugin.factoryloader: looking at "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlodbc.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlodbc.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QODBC"
            ]
        },
        "archlevel": 2,
        "className": "QODBCDriverPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QODBC")
    qt.core.plugin.factoryloader: looking at "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlpsql.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlpsql.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QPSQL"
            ]
        },
        "archlevel": 2,
        "className": "QPSQLDriverPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
    QList("QSQLITE", "QMIMER", "QMARIADB", "QMYSQL", "QODBC", "QPSQL")
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/qtquick2plugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "archlevel": 2,
        "className": "QtQuick2Plugin",
        "debug": false,
        "uri": [
            "QtQuick"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/qtquick2plugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQml/WorkerScript/workerscriptplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
        "archlevel": 2,
        "className": "QtQmlWorkerScriptPlugin",
        "debug": false,
        "uri": [
            "QtQml.WorkerScript"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQml/WorkerScript/workerscriptplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Effects/effectsplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
        "archlevel": 2,
        "className": "QtQuickEffectsPlugin",
        "debug": false,
        "uri": [
            "QtQuick.Effects"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Effects/effectsplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Window/quickwindowplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
        "archlevel": 2,
        "className": "QtQuick_WindowPlugin",
        "debug": false,
        "uri": [
            "QtQuick.Window"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Window/quickwindowplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/qtquickcontrols2plugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "archlevel": 2,
        "className": "QtQuickControls2Plugin",
        "debug": false,
        "uri": [
            "QtQuick.Controls"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/qtquickcontrols2plugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Windows/qtquickcontrols2windowsstyleplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "archlevel": 2,
        "className": "QtQuickControls2WindowsStylePlugin",
        "debug": false,
        "uri": [
            "QtQuick.Controls.Windows"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Windows/qtquickcontrols2windowsstyleplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Basic/qtquickcontrols2basicstyleplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "archlevel": 2,
        "className": "QtQuickControls2BasicStylePlugin",
        "debug": false,
        "uri": [
            "QtQuick.Controls.Basic"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Basic/qtquickcontrols2basicstyleplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/impl/qtquickcontrols2implplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
        "archlevel": 2,
        "className": "QtQuickControls2ImplPlugin",
        "debug": false,
        "uri": [
            "QtQuick.Controls.impl"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/impl/qtquickcontrols2implplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Fusion/qtquickcontrols2fusionstyleplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "archlevel": 2,
        "className": "QtQuickControls2FusionStylePlugin",
        "debug": false,
        "uri": [
            "QtQuick.Controls.Fusion"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Fusion/qtquickcontrols2fusionstyleplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Material/qtquickcontrols2materialstyleplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "archlevel": 2,
        "className": "QtQuickControls2MaterialStylePlugin",
        "debug": false,
        "uri": [
            "QtQuick.Controls.Material"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Material/qtquickcontrols2materialstyleplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/qtgraphicaleffectsplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "archlevel": 2,
        "className": "QtGraphicalEffectsPlugin",
        "debug": false,
        "uri": [
            "Qt5Compat.GraphicalEffects"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/qtgraphicaleffectsplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Layouts/qquicklayoutsplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
        "archlevel": 2,
        "className": "QtQuickLayoutsPlugin",
        "debug": false,
        "uri": [
            "QtQuick.Layouts"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Layouts/qquicklayoutsplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Templates/qtquicktemplates2plugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "archlevel": 2,
        "className": "QtQuickTemplates2Plugin",
        "debug": false,
        "uri": [
            "QtQuick.Templates"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Templates/qtquicktemplates2plugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/NativeStyle/qtquickcontrols2nativestyleplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
        "archlevel": 2,
        "className": "QtQuickControls2NativeStylePlugin",
        "debug": false,
        "uri": [
            "QtQuick.NativeStyle"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/NativeStyle/qtquickcontrols2nativestyleplugin.dll" loaded library
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/private/qtgraphicaleffectsprivateplugin.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
        "archlevel": 2,
        "className": "QtGraphicalEffectsPrivatePlugin",
        "debug": false,
        "uri": [
            "Qt5Compat.GraphicalEffects.private"
        ],
        "version": 394752
    }
    
    
    qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/private/qtgraphicaleffectsprivateplugin.dll" loaded library
    qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.6.2/mingw_64/plugins/imageformats" ...
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qgif.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qgif.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "gif"
            ],
            "MimeTypes": [
                "image/gif"
            ]
        },
        "archlevel": 2,
        "className": "QGifPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("gif")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qicns.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qicns.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "icns"
            ],
            "MimeTypes": [
                "image/x-icns"
            ]
        },
        "archlevel": 2,
        "className": "QICNSPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("icns")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qico.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qico.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "ico",
                "cur"
            ],
            "MimeTypes": [
                "image/vnd.microsoft.icon",
                "image/vnd.microsoft.icon"
            ]
        },
        "archlevel": 2,
        "className": "QICOPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ico", "cur")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qjpeg.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qjpeg.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "jpg",
                "jpeg"
            ],
            "MimeTypes": [
                "image/jpeg",
                "image/jpeg"
            ]
        },
        "archlevel": 2,
        "className": "QJpegPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("jpg", "jpeg")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qpdf.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qpdf.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "pdf"
            ],
            "MimeTypes": [
                "application/pdf"
            ]
        },
        "archlevel": 2,
        "className": "QPdfPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("pdf")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qsvg.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qsvg.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "svg",
                "svgz"
            ],
            "MimeTypes": [
                "image/svg+xml",
                "image/svg+xml-compressed"
            ]
        },
        "archlevel": 2,
        "className": "QSvgPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("svg", "svgz")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtga.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtga.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "tga"
            ],
            "MimeTypes": [
                "image/x-tga"
            ]
        },
        "archlevel": 2,
        "className": "QTgaPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("tga")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtiff.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtiff.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "tiff",
                "tif"
            ],
            "MimeTypes": [
                "image/tiff",
                "image/tiff"
            ]
        },
        "archlevel": 2,
        "className": "QTiffPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("tiff", "tif")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwbmp.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwbmp.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "wbmp"
            ],
            "MimeTypes": [
                "image/vnd.wap.wbmp"
            ]
        },
        "archlevel": 2,
        "className": "QWbmpPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wbmp")
    qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwebp.dll"
    qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwebp.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "webp"
            ],
            "MimeTypes": [
                "image/webp"
            ]
        },
        "archlevel": 2,
        "className": "QWebpPlugin",
        "debug": false,
        "version": 394752
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("webp")
    qt.core.plugin.factoryloader: checking directory path "C:/Users/x/OneDrive - y/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/imageformats" ...
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qgif.dll" loaded library
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qicns.dll" loaded library
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qico.dll" loaded library
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qjpeg.dll" loaded library
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qpdf.dll" loaded library
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qsvg.dll" loaded library
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtga.dll" loaded library
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtiff.dll" loaded library
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwbmp.dll" loaded library
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwebp.dll" loaded library
    qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.6.2/mingw_64/plugins/accessible" ...
    qt.core.plugin.factoryloader: checking directory path "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/accessible" ...
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library
    QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
    QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
    "Driver not loaded Driver not loaded"
    QML debugging is enabled. Only use this in a safe environment.
    terminate called after throwing an instance of 'std::runtime_error'
      what():  Error: Driver not loaded Driver not loaded
    "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qgif.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qicns.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qico.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qjpeg.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qpdf.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qsvg.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtga.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtiff.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwbmp.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwebp.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/platforms/qwindows.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmysql.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/private/qtgraphicaleffectsprivateplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/qtgraphicaleffectsplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQml/WorkerScript/workerscriptplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Basic/qtquickcontrols2basicstyleplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Fusion/qtquickcontrols2fusionstyleplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Material/qtquickcontrols2materialstyleplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Windows/qtquickcontrols2windowsstyleplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/impl/qtquickcontrols2implplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/qtquickcontrols2plugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Effects/effectsplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Layouts/qquicklayoutsplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/NativeStyle/qtquickcontrols2nativestyleplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Templates/qtquicktemplates2plugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Window/quickwindowplugin.dll" unloaded library 
    "C:/Qt/6.6.2/mingw_64/qml/QtQuick/qtquick2plugin.dll" unloaded library 
    

    Strings of interest that I can find:
    QList("QSQLITE", "QMIMER", "QMARIADB", "QMYSQL", "QODBC", "QPSQL")
    qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library
    Driver not loaded

    How on God's green earth does this make sense? Its incredible how complex setting this up is.

    QSqlDatabase::open() returns false.

    J 1 Reply Last reply 13 Mar 2024, 11:25
    0
    • C CodeBroker
      13 Mar 2024, 11:13

      Hello

      Short story: Trying to get MySQL to work with Qt. I have been struggling with this for over a day, and I have scraped the whole world wide web for a solution.

      Qt Version = 6.6.2
      Compiler = MinGW 64 11.2.0

      I have compiled the QMYSQL driver from source.

      QT_DEBUG_PLUGINS yields this:

      qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.6.2/mingw_64/plugins/platforms" ...
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/platforms/qdirect2d.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/platforms/qdirect2d.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "direct2d"
              ]
          },
          "archlevel": 2,
          "className": "QWindowsDirect2DIntegrationPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("direct2d")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/platforms/qminimal.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/platforms/qminimal.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "minimal"
              ]
          },
          "archlevel": 2,
          "className": "QMinimalIntegrationPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/platforms/qoffscreen.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/platforms/qoffscreen.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "offscreen"
              ]
          },
          "archlevel": 2,
          "className": "QOffscreenIntegrationPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/platforms/qwindows.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/platforms/qwindows.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "windows"
              ]
          },
          "archlevel": 2,
          "className": "QWindowsIntegrationPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("windows")
      qt.core.plugin.factoryloader: checking directory path "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/platforms" ...
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/platforms/qwindows.dll" loaded library
      qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.6.2/mingw_64/plugins/platformthemes" ...
      qt.core.plugin.factoryloader: checking directory path "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/platformthemes" ...
      qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers" ...
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlite.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlite.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QSQLITE"
              ]
          },
          "archlevel": 2,
          "className": "QSQLiteDriverPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmimer.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmimer.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QMIMER"
              ]
          },
          "archlevel": 2,
          "className": "QMimerSQLDriverPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMIMER")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmysql.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QMYSQL",
                  "QMARIADB"
              ]
          },
          "archlevel": 2,
          "className": "QMYSQLDriverPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlodbc.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QODBC"
              ]
          },
          "archlevel": 2,
          "className": "QODBCDriverPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QODBC")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlpsql.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QPSQL"
              ]
          },
          "archlevel": 2,
          "className": "QPSQLDriverPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
      qt.core.plugin.factoryloader: checking directory path "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers" ...
      qt.core.plugin.factoryloader: looking at "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlite.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlite.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QSQLITE"
              ]
          },
          "archlevel": 2,
          "className": "QSQLiteDriverPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
      qt.core.plugin.factoryloader: looking at "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlmimer.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlmimer.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QMIMER"
              ]
          },
          "archlevel": 2,
          "className": "QMimerSQLDriverPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMIMER")
      qt.core.plugin.factoryloader: looking at "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlmysql.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlmysql.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QMYSQL",
                  "QMARIADB"
              ]
          },
          "archlevel": 2,
          "className": "QMYSQLDriverPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB")
      qt.core.plugin.factoryloader: looking at "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlodbc.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlodbc.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QODBC"
              ]
          },
          "archlevel": 2,
          "className": "QODBCDriverPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QODBC")
      qt.core.plugin.factoryloader: looking at "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlpsql.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/sqldrivers/qsqlpsql.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QPSQL"
              ]
          },
          "archlevel": 2,
          "className": "QPSQLDriverPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
      QList("QSQLITE", "QMIMER", "QMARIADB", "QMYSQL", "QODBC", "QPSQL")
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/qtquick2plugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
          "archlevel": 2,
          "className": "QtQuick2Plugin",
          "debug": false,
          "uri": [
              "QtQuick"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/qtquick2plugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQml/WorkerScript/workerscriptplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
          "archlevel": 2,
          "className": "QtQmlWorkerScriptPlugin",
          "debug": false,
          "uri": [
              "QtQml.WorkerScript"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQml/WorkerScript/workerscriptplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Effects/effectsplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
          "archlevel": 2,
          "className": "QtQuickEffectsPlugin",
          "debug": false,
          "uri": [
              "QtQuick.Effects"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Effects/effectsplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Window/quickwindowplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
          "archlevel": 2,
          "className": "QtQuick_WindowPlugin",
          "debug": false,
          "uri": [
              "QtQuick.Window"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Window/quickwindowplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/qtquickcontrols2plugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
          "archlevel": 2,
          "className": "QtQuickControls2Plugin",
          "debug": false,
          "uri": [
              "QtQuick.Controls"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/qtquickcontrols2plugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Windows/qtquickcontrols2windowsstyleplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
          "archlevel": 2,
          "className": "QtQuickControls2WindowsStylePlugin",
          "debug": false,
          "uri": [
              "QtQuick.Controls.Windows"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Windows/qtquickcontrols2windowsstyleplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Basic/qtquickcontrols2basicstyleplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
          "archlevel": 2,
          "className": "QtQuickControls2BasicStylePlugin",
          "debug": false,
          "uri": [
              "QtQuick.Controls.Basic"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Basic/qtquickcontrols2basicstyleplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/impl/qtquickcontrols2implplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
          "archlevel": 2,
          "className": "QtQuickControls2ImplPlugin",
          "debug": false,
          "uri": [
              "QtQuick.Controls.impl"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/impl/qtquickcontrols2implplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Fusion/qtquickcontrols2fusionstyleplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
          "archlevel": 2,
          "className": "QtQuickControls2FusionStylePlugin",
          "debug": false,
          "uri": [
              "QtQuick.Controls.Fusion"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Fusion/qtquickcontrols2fusionstyleplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Material/qtquickcontrols2materialstyleplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
          "archlevel": 2,
          "className": "QtQuickControls2MaterialStylePlugin",
          "debug": false,
          "uri": [
              "QtQuick.Controls.Material"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Material/qtquickcontrols2materialstyleplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/qtgraphicaleffectsplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
          "archlevel": 2,
          "className": "QtGraphicalEffectsPlugin",
          "debug": false,
          "uri": [
              "Qt5Compat.GraphicalEffects"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/qtgraphicaleffectsplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Layouts/qquicklayoutsplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
          "archlevel": 2,
          "className": "QtQuickLayoutsPlugin",
          "debug": false,
          "uri": [
              "QtQuick.Layouts"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Layouts/qquicklayoutsplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/Templates/qtquicktemplates2plugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
          "archlevel": 2,
          "className": "QtQuickTemplates2Plugin",
          "debug": false,
          "uri": [
              "QtQuick.Templates"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Templates/qtquicktemplates2plugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/QtQuick/NativeStyle/qtquickcontrols2nativestyleplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlExtensionInterface/1.0",
          "archlevel": 2,
          "className": "QtQuickControls2NativeStylePlugin",
          "debug": false,
          "uri": [
              "QtQuick.NativeStyle"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/QtQuick/NativeStyle/qtquickcontrols2nativestyleplugin.dll" loaded library
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/private/qtgraphicaleffectsprivateplugin.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QQmlEngineExtensionInterface",
          "archlevel": 2,
          "className": "QtGraphicalEffectsPrivatePlugin",
          "debug": false,
          "uri": [
              "Qt5Compat.GraphicalEffects.private"
          ],
          "version": 394752
      }
      
      
      qt.core.library: "C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/private/qtgraphicaleffectsprivateplugin.dll" loaded library
      qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.6.2/mingw_64/plugins/imageformats" ...
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qgif.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qgif.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
          "MetaData": {
              "Keys": [
                  "gif"
              ],
              "MimeTypes": [
                  "image/gif"
              ]
          },
          "archlevel": 2,
          "className": "QGifPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("gif")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qicns.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qicns.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
          "MetaData": {
              "Keys": [
                  "icns"
              ],
              "MimeTypes": [
                  "image/x-icns"
              ]
          },
          "archlevel": 2,
          "className": "QICNSPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("icns")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qico.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qico.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
          "MetaData": {
              "Keys": [
                  "ico",
                  "cur"
              ],
              "MimeTypes": [
                  "image/vnd.microsoft.icon",
                  "image/vnd.microsoft.icon"
              ]
          },
          "archlevel": 2,
          "className": "QICOPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ico", "cur")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qjpeg.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qjpeg.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
          "MetaData": {
              "Keys": [
                  "jpg",
                  "jpeg"
              ],
              "MimeTypes": [
                  "image/jpeg",
                  "image/jpeg"
              ]
          },
          "archlevel": 2,
          "className": "QJpegPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("jpg", "jpeg")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qpdf.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qpdf.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
          "MetaData": {
              "Keys": [
                  "pdf"
              ],
              "MimeTypes": [
                  "application/pdf"
              ]
          },
          "archlevel": 2,
          "className": "QPdfPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("pdf")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qsvg.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qsvg.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
          "MetaData": {
              "Keys": [
                  "svg",
                  "svgz"
              ],
              "MimeTypes": [
                  "image/svg+xml",
                  "image/svg+xml-compressed"
              ]
          },
          "archlevel": 2,
          "className": "QSvgPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("svg", "svgz")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtga.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtga.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
          "MetaData": {
              "Keys": [
                  "tga"
              ],
              "MimeTypes": [
                  "image/x-tga"
              ]
          },
          "archlevel": 2,
          "className": "QTgaPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("tga")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtiff.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtiff.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
          "MetaData": {
              "Keys": [
                  "tiff",
                  "tif"
              ],
              "MimeTypes": [
                  "image/tiff",
                  "image/tiff"
              ]
          },
          "archlevel": 2,
          "className": "QTiffPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("tiff", "tif")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwbmp.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwbmp.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
          "MetaData": {
              "Keys": [
                  "wbmp"
              ],
              "MimeTypes": [
                  "image/vnd.wap.wbmp"
              ]
          },
          "archlevel": 2,
          "className": "QWbmpPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wbmp")
      qt.core.plugin.factoryloader: looking at "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwebp.dll"
      qt.core.plugin.loader: Found metadata in lib C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwebp.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
          "MetaData": {
              "Keys": [
                  "webp"
              ],
              "MimeTypes": [
                  "image/webp"
              ]
          },
          "archlevel": 2,
          "className": "QWebpPlugin",
          "debug": false,
          "version": 394752
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("webp")
      qt.core.plugin.factoryloader: checking directory path "C:/Users/x/OneDrive - y/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/imageformats" ...
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qgif.dll" loaded library
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qicns.dll" loaded library
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qico.dll" loaded library
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qjpeg.dll" loaded library
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qpdf.dll" loaded library
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qsvg.dll" loaded library
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtga.dll" loaded library
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtiff.dll" loaded library
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwbmp.dll" loaded library
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwebp.dll" loaded library
      qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.6.2/mingw_64/plugins/accessible" ...
      qt.core.plugin.factoryloader: checking directory path "C:/Users/censored/OneDrive - censored/Qt prosjekter/build-censored-Desktop_Qt_6_6_2_MinGW_64_bit-Debug/accessible" ...
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library
      QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
      QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
      "Driver not loaded Driver not loaded"
      QML debugging is enabled. Only use this in a safe environment.
      terminate called after throwing an instance of 'std::runtime_error'
        what():  Error: Driver not loaded Driver not loaded
      "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qgif.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qicns.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qico.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qjpeg.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qpdf.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qsvg.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtga.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qtiff.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwbmp.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/imageformats/qwebp.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/platforms/qwindows.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmysql.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/private/qtgraphicaleffectsprivateplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/Qt5Compat/GraphicalEffects/qtgraphicaleffectsplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQml/WorkerScript/workerscriptplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Basic/qtquickcontrols2basicstyleplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Fusion/qtquickcontrols2fusionstyleplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Material/qtquickcontrols2materialstyleplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/Windows/qtquickcontrols2windowsstyleplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/impl/qtquickcontrols2implplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Controls/qtquickcontrols2plugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Effects/effectsplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Layouts/qquicklayoutsplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/NativeStyle/qtquickcontrols2nativestyleplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Templates/qtquicktemplates2plugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/Window/quickwindowplugin.dll" unloaded library 
      "C:/Qt/6.6.2/mingw_64/qml/QtQuick/qtquick2plugin.dll" unloaded library 
      

      Strings of interest that I can find:
      QList("QSQLITE", "QMIMER", "QMARIADB", "QMYSQL", "QODBC", "QPSQL")
      qt.core.library: "C:/Qt/6.6.2/mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library
      Driver not loaded

      How on God's green earth does this make sense? Its incredible how complex setting this up is.

      QSqlDatabase::open() returns false.

      J Offline
      J Offline
      JonB
      wrote on 13 Mar 2024, 11:25 last edited by
      #2

      @CodeBroker
      I am not sure where exactly what is going wrong here. Initially at least it does not say that the driver is not loaded, the first error message I see is

      QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.

      I see that QMYSQL appears to be picked up from two places, and one of them is One Drive. I would start by getting rid of that: let it just find one QMYSQL/QMARIADB, and let that be local not on One Drive.

      After that please show your absolute minimal program using QSqlDatabase::addDatabase().

      C 1 Reply Last reply 13 Mar 2024, 12:55
      0
      • J JonB
        13 Mar 2024, 11:25

        @CodeBroker
        I am not sure where exactly what is going wrong here. Initially at least it does not say that the driver is not loaded, the first error message I see is

        QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.

        I see that QMYSQL appears to be picked up from two places, and one of them is One Drive. I would start by getting rid of that: let it just find one QMYSQL/QMARIADB, and let that be local not on One Drive.

        After that please show your absolute minimal program using QSqlDatabase::addDatabase().

        C Offline
        C Offline
        CodeBroker
        wrote on 13 Mar 2024, 12:55 last edited by
        #3

        @JonB

        This:

        QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
        

        Should not, according to the documentation, cause any problems related to what Im experiencing.

        My project is stored in OneDrive, along with my build files. I have now removed every trace of sql there, yet I still get the same error messages. If there was a problem with Qt and OneDrive, I would be having more issues, so I doubt that is the culprit.

        Main.cpp

        int main(int argc, char *argv[])
        {
            QGuiApplication app(argc, argv);
            QQmlApplicationEngine engine;
            qDebug() << QSqlDatabase::drivers();
            const QUrl url(u"qrc:/x/Main.qml"_qs);
            QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
                &app, []() { QCoreApplication::exit(-1); },
                Qt::QueuedConnection);
            engine.load(url);
            Database db("QMYSQL", "127.0.0.1", "x", "y", "z");
            return app.exec();
        }
        
        

        Database.h

        #ifndef DATABASE_H
        #define DATABASE_H
        
        #include <QObject>
        #include <QtSql/QSqlDriver>
        #include <QtSql>
        #include <QDebug>
        #include <QSqlDatabase>
        #include <QSqlError>
        
        
        class Database : public QObject {
        
            Q_OBJECT
        public:
            explicit Database(const QString& driverType, const QString& hostName, const QString& dbName, const QString& userName, const QString& password, QObject* parent = nullptr);
            ~Database();
        
        private:
            QSqlDatabase m_db;
        };
        
        #endif // DATABASE_H
        
        

        Database.cpp

        Database::Database(const QString &driverType, const QString &hostName, const QString &dbName, const QString &userName, const QString &password, QObject* parent) : QObject(parent)
        {
            if (!QSqlDatabase::drivers().contains(driverType)) {
                qDebug() << driverType + " does not exist.";
                throw std::runtime_error{driverType.toStdString() + " does not exist."};
                this->~Database();
                exit(EXIT_FAILURE);
            }
        
            m_db = QSqlDatabase::addDatabase(driverType);
            if (!m_db.isValid()) {
                throw std::runtime_error{m_db.lastError().text().toStdString()};
                this->~Database();
                exit(EXIT_FAILURE);
            }
        
            m_db.addDatabase(driverType);
            m_db.setHostName(hostName);
            m_db.setDatabaseName(dbName);
            m_db.setUserName(userName);
            m_db.setPassword(password);
        
        
            if (!m_db.open()) {
                qDebug() << m_db.lastError().text();
                throw std::runtime_error{"Error: " + m_db.lastError().text().toStdString()};
                this->~Database();
                exit(EXIT_FAILURE);
            }
        }
        
        J 1 Reply Last reply 13 Mar 2024, 13:04
        0
        • C CodeBroker
          13 Mar 2024, 12:55

          @JonB

          This:

          QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
          

          Should not, according to the documentation, cause any problems related to what Im experiencing.

          My project is stored in OneDrive, along with my build files. I have now removed every trace of sql there, yet I still get the same error messages. If there was a problem with Qt and OneDrive, I would be having more issues, so I doubt that is the culprit.

          Main.cpp

          int main(int argc, char *argv[])
          {
              QGuiApplication app(argc, argv);
              QQmlApplicationEngine engine;
              qDebug() << QSqlDatabase::drivers();
              const QUrl url(u"qrc:/x/Main.qml"_qs);
              QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
                  &app, []() { QCoreApplication::exit(-1); },
                  Qt::QueuedConnection);
              engine.load(url);
              Database db("QMYSQL", "127.0.0.1", "x", "y", "z");
              return app.exec();
          }
          
          

          Database.h

          #ifndef DATABASE_H
          #define DATABASE_H
          
          #include <QObject>
          #include <QtSql/QSqlDriver>
          #include <QtSql>
          #include <QDebug>
          #include <QSqlDatabase>
          #include <QSqlError>
          
          
          class Database : public QObject {
          
              Q_OBJECT
          public:
              explicit Database(const QString& driverType, const QString& hostName, const QString& dbName, const QString& userName, const QString& password, QObject* parent = nullptr);
              ~Database();
          
          private:
              QSqlDatabase m_db;
          };
          
          #endif // DATABASE_H
          
          

          Database.cpp

          Database::Database(const QString &driverType, const QString &hostName, const QString &dbName, const QString &userName, const QString &password, QObject* parent) : QObject(parent)
          {
              if (!QSqlDatabase::drivers().contains(driverType)) {
                  qDebug() << driverType + " does not exist.";
                  throw std::runtime_error{driverType.toStdString() + " does not exist."};
                  this->~Database();
                  exit(EXIT_FAILURE);
              }
          
              m_db = QSqlDatabase::addDatabase(driverType);
              if (!m_db.isValid()) {
                  throw std::runtime_error{m_db.lastError().text().toStdString()};
                  this->~Database();
                  exit(EXIT_FAILURE);
              }
          
              m_db.addDatabase(driverType);
              m_db.setHostName(hostName);
              m_db.setDatabaseName(dbName);
              m_db.setUserName(userName);
              m_db.setPassword(password);
          
          
              if (!m_db.open()) {
                  qDebug() << m_db.lastError().text();
                  throw std::runtime_error{"Error: " + m_db.lastError().text().toStdString()};
                  this->~Database();
                  exit(EXIT_FAILURE);
              }
          }
          
          J Offline
          J Offline
          JonB
          wrote on 13 Mar 2024, 13:04 last edited by JonB
          #4

          @CodeBroker
          Never had the QSqlDatabasePrivate::*Database... messages. I suspect they could come from your member variable QSqlDatabase m_db;, which I am sure when @SGaist sees he will ask you to remove and follow what the docs recommend!

          I'm not sure just where your plain Driver not loaded messages come from/where in the sequence of your code execution. I'm also not sure what the consequences are of trying to add the same database driver twice. I understand you may not be getting as far as my points. Maybe someone else will know better.

          You have a bunch of other available drivers: does the driver load on any of them?

          C 1 Reply Last reply 13 Mar 2024, 13:22
          1
          • C Christian Ehrlicher moved this topic from QML and Qt Quick on 13 Mar 2024, 13:19
          • J JonB
            13 Mar 2024, 13:04

            @CodeBroker
            Never had the QSqlDatabasePrivate::*Database... messages. I suspect they could come from your member variable QSqlDatabase m_db;, which I am sure when @SGaist sees he will ask you to remove and follow what the docs recommend!

            I'm not sure just where your plain Driver not loaded messages come from/where in the sequence of your code execution. I'm also not sure what the consequences are of trying to add the same database driver twice. I understand you may not be getting as far as my points. Maybe someone else will know better.

            You have a bunch of other available drivers: does the driver load on any of them?

            C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 13 Mar 2024, 13:22 last edited by
            #5

            Use a proper init function instead doing strange stuff in the ctor. And according to the debug output you somewhere open the database twice.
            Please provide a minimal, compileable example without any qml stuff to reproduce the problem.

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

            C 1 Reply Last reply 13 Mar 2024, 13:35
            1
            • C Christian Ehrlicher
              13 Mar 2024, 13:22

              Use a proper init function instead doing strange stuff in the ctor. And according to the debug output you somewhere open the database twice.
              Please provide a minimal, compileable example without any qml stuff to reproduce the problem.

              C Offline
              C Offline
              CodeBroker
              wrote on 13 Mar 2024, 13:35 last edited by
              #6

              @Christian-Ehrlicher

              Im not sure what strange stuff you're referring to, please enlighten me. And, even if strange, how would that cause this issue?

              App works fine without initializing the class.

              C S 2 Replies Last reply 13 Mar 2024, 13:52
              0
              • C CodeBroker
                13 Mar 2024, 13:35

                @Christian-Ehrlicher

                Im not sure what strange stuff you're referring to, please enlighten me. And, even if strange, how would that cause this issue?

                App works fine without initializing the class.

                C Offline
                C Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 13 Mar 2024, 13:52 last edited by
                #7

                @CodeBroker said in QSqlDatabase "Driver not loaded" 🤔🤨:

                not sure what strange stuff you're referring

                The exceptions where you try to call the dtor after throwing. Luckily the dtor is never called due to the throw. It's simply bad design not doing this in a separate init function.
                And you somewhere open the db a second time so reduce your code until the message about the removeDatabase problem goes away or provide a minimal, compileable example so we can take a look on it.

                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
                3
                • H Online
                  H Online
                  hskoglund
                  wrote on 13 Mar 2024, 13:58 last edited by
                  #8

                  To add to what @Christian-Ehrlicher says re. the duplicate calls to addDateBase(), try removing the 2nd one, say something like this:

                      ..
                      m_db = QSqlDatabase::addDatabase(driverType);
                      if (!m_db.isValid())
                          return;
                  
                      // comment out the 2nd invocation 
                      // m_db.addDatabase(driverType);
                      m_db.setHostName(hostName);
                      ...
                  
                  C 1 Reply Last reply 14 Mar 2024, 08:37
                  3
                  • C CodeBroker
                    13 Mar 2024, 13:35

                    @Christian-Ehrlicher

                    Im not sure what strange stuff you're referring to, please enlighten me. And, even if strange, how would that cause this issue?

                    App works fine without initializing the class.

                    S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 13 Mar 2024, 21:07 last edited by
                    #9

                    @CodeBroker @JonB is correct, don't store a QSqlDatabase object as member variable. It's explained in the documentation.

                    As @hskoglund wrote, your second call to addDatabase is what triggers the message. By the way addDatabase is a static method, it won't change your m_db object.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • H hskoglund
                      13 Mar 2024, 13:58

                      To add to what @Christian-Ehrlicher says re. the duplicate calls to addDateBase(), try removing the 2nd one, say something like this:

                          ..
                          m_db = QSqlDatabase::addDatabase(driverType);
                          if (!m_db.isValid())
                              return;
                      
                          // comment out the 2nd invocation 
                          // m_db.addDatabase(driverType);
                          m_db.setHostName(hostName);
                          ...
                      
                      C Offline
                      C Offline
                      CodeBroker
                      wrote on 14 Mar 2024, 08:37 last edited by
                      #10

                      @hskoglund

                      Wow thanks a lot for pointing this out. This was the problem.

                      Case resolved :)

                      J 1 Reply Last reply 14 Mar 2024, 08:44
                      0
                      • C CodeBroker has marked this topic as solved on 14 Mar 2024, 08:38
                      • C CodeBroker
                        14 Mar 2024, 08:37

                        @hskoglund

                        Wow thanks a lot for pointing this out. This was the problem.

                        Case resolved :)

                        J Offline
                        J Offline
                        JonB
                        wrote on 14 Mar 2024, 08:44 last edited by
                        #11

                        @CodeBroker

                        @JonB said in QSqlDatabase "Driver not loaded" 🤔🤨:

                        I'm also not sure what the consequences are of trying to add the same database driver twice

                        Nobody reads what I write in the first place! '-(

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SEB MARS
                          wrote on 14 Mar 2024, 16:18 last edited by SEB MARS
                          #12

                          Hi I'm new to Qt and GUI programming and development. I'M a UX and UI Designer trying my hand at actually coding a complex software I have developped. SO I have to start from the beginnign and I'm following a book to get my hands and branin wrapped around these new concepts and I have encountered a first error that I have been trying to figure out with the help of Chat GPT but I have come to the end of what I can do alone.

                          here is the problem.

                          I have installed MAMP to manage the webserver and the MYSQL databse.
                          I have created some tables and populated them
                          Now i want to connect the GUI i have designed with Qt (A simple login form)
                          but I get this error messag when trying to compile

                          12:08:00: Starting /Users/sebastienmarchi/Qt Projects/2024 01 Sandbox2/build-DatabaseConn-Qt_6_8_0_for_macOS-Debug/DatabaseConn...
                          12:08:00: Environment:
                          __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
                          __CFBundleIdentifier=org.qt-project.qtcreator
                          COMMAND_MODE=unix2003
                          DYLD_FRAMEWORK_PATH=/Users/sebastienmarchi/Qt Projects/2024 01 Sandbox2/DatabaseConn:/usr/local/Cellar/mysql/8.3.0_1/lib/libmysqlclient.dylib:/Users/sebastienmarchi/Qt6/6.8.0/macos/lib
                          DYLD_LIBRARY_PATH=/Users/sebastienmarchi/Qt Projects/2024 01 Sandbox2/DatabaseConn:/usr/local/Cellar/mysql/8.3.0_1/lib/libmysqlclient.dylib:/Users/sebastienmarchi/Qt6/6.8.0/macos/lib
                          HOME=/Users/sebastienmarchi
                          LOGNAME=sebastienmarchi
                          PATH=/Users/sebastienmarchi/Qt6/6.8.0/macos/bin:/usr/bin:/bin:/usr/sbin:/sbin
                          QTDIR=/Users/sebastienmarchi/Qt6/6.8.0/macos
                          SHELL=/bin/bash
                          SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.gWvkjBV314/Listeners
                          TMPDIR=/var/folders/hh/zt4mxsmd3hg8qfhx18wrtpw80000gn/T/
                          USER=sebastienmarchi
                          XPC_FLAGS=0x0
                          XPC_SERVICE_NAME=application.org.qt-project.qtcreator.124158950.124214104
                          
                          QSqlDatabase: QMYSQL driver not loaded
                          QSqlDatabase: available drivers: QSQLITE QODBC QPSQL QMIMER
                          Failed to connect.
                          12:08:00: /Users/sebastienmarchi/Qt Projects/2024 01 Sandbox2/build-DatabaseConn-Qt_6_8_0_for_macOS-Debug/DatabaseConn exited with code 0
                          

                          Using :
                          Qt Creator 12.0.2
                          Based on Qt 6.6.0 (Clang 13.0 (Apple), x86_64)

                          Built on Feb 6 2024 10:31:14

                          C 1 Reply Last reply 14 Mar 2024, 16:32
                          0
                          • S SEB MARS
                            14 Mar 2024, 16:18

                            Hi I'm new to Qt and GUI programming and development. I'M a UX and UI Designer trying my hand at actually coding a complex software I have developped. SO I have to start from the beginnign and I'm following a book to get my hands and branin wrapped around these new concepts and I have encountered a first error that I have been trying to figure out with the help of Chat GPT but I have come to the end of what I can do alone.

                            here is the problem.

                            I have installed MAMP to manage the webserver and the MYSQL databse.
                            I have created some tables and populated them
                            Now i want to connect the GUI i have designed with Qt (A simple login form)
                            but I get this error messag when trying to compile

                            12:08:00: Starting /Users/sebastienmarchi/Qt Projects/2024 01 Sandbox2/build-DatabaseConn-Qt_6_8_0_for_macOS-Debug/DatabaseConn...
                            12:08:00: Environment:
                            __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
                            __CFBundleIdentifier=org.qt-project.qtcreator
                            COMMAND_MODE=unix2003
                            DYLD_FRAMEWORK_PATH=/Users/sebastienmarchi/Qt Projects/2024 01 Sandbox2/DatabaseConn:/usr/local/Cellar/mysql/8.3.0_1/lib/libmysqlclient.dylib:/Users/sebastienmarchi/Qt6/6.8.0/macos/lib
                            DYLD_LIBRARY_PATH=/Users/sebastienmarchi/Qt Projects/2024 01 Sandbox2/DatabaseConn:/usr/local/Cellar/mysql/8.3.0_1/lib/libmysqlclient.dylib:/Users/sebastienmarchi/Qt6/6.8.0/macos/lib
                            HOME=/Users/sebastienmarchi
                            LOGNAME=sebastienmarchi
                            PATH=/Users/sebastienmarchi/Qt6/6.8.0/macos/bin:/usr/bin:/bin:/usr/sbin:/sbin
                            QTDIR=/Users/sebastienmarchi/Qt6/6.8.0/macos
                            SHELL=/bin/bash
                            SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.gWvkjBV314/Listeners
                            TMPDIR=/var/folders/hh/zt4mxsmd3hg8qfhx18wrtpw80000gn/T/
                            USER=sebastienmarchi
                            XPC_FLAGS=0x0
                            XPC_SERVICE_NAME=application.org.qt-project.qtcreator.124158950.124214104
                            
                            QSqlDatabase: QMYSQL driver not loaded
                            QSqlDatabase: available drivers: QSQLITE QODBC QPSQL QMIMER
                            Failed to connect.
                            12:08:00: /Users/sebastienmarchi/Qt Projects/2024 01 Sandbox2/build-DatabaseConn-Qt_6_8_0_for_macOS-Debug/DatabaseConn exited with code 0
                            

                            Using :
                            Qt Creator 12.0.2
                            Based on Qt 6.6.0 (Clang 13.0 (Apple), x86_64)

                            Built on Feb 6 2024 10:31:14

                            C Offline
                            C Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on 14 Mar 2024, 16:32 last edited by
                            #13

                            @SEB-MARS As you can see the Mysql plugin is not available - you have to compile it by yourself (blame MySQL, not Qt) as described here.

                            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

                            8/13

                            13 Mar 2024, 13:58

                            • Login

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