<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Getting QSqlError &quot;Driver not loaded&quot;]]></title><description><![CDATA[<p dir="auto">I have found a few posts referring to this kind of error and they say to ensure you enable QT_DEBUG_PLUGINS  so it will tell you why the driver isn't loaded. However, if I do that I just get this:</p>
<pre><code>qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
qt.core.plugin.factoryloader: checking directory path "C:/Software/Qt/MT47/MT47SW01/build/Desktop_Qt_6_10_2_MinGW_64_bit-Release/release/sqldrivers" ...
qt.sql.qsqldatabase: QSqlDatabase: can not load requested driver 'QMYSQL', available drivers: QIBASE QSQLITE QMIMER QOCI QODBC QPSQL
</code></pre>
<p dir="auto">As the only reference to it.</p>
<p dir="auto">A bit of background on this:</p>
<p dir="auto">I have had this working on Linux for ages no problem, but need to give some Windows users the same functionality.  So I have checked out the code and built it, it builds and runs fine, but I get this "Driver not loaded" error.</p>
<p dir="auto">I have tried installing mysql drivers from Oracle no no avail. I've found some post saying you need to build them so I went down that rabbit hole and then saw this:</p>
<pre><code>Note: As of MySQL 8.0.19, the C Connector is no longer offered as a standalone installable component. Instead, you can get mysql.h and libmysql.* by installing the full MySQL Server (x64 only) or the MariaDB C Connector.
</code></pre>
<p dir="auto">And eventually mabnaged to install libmariadb.lib and libmariadb.dll (as we are using Maria db on the server side).</p>
<p dir="auto">Adding this:</p>
<p dir="auto">win32: LIBS += -L"C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib" -llibmariadb</p>
<p dir="auto">To my project file, but I <em>still</em> get the same error.</p>
<p dir="auto">I have tried using both MSVC and mingw,</p>
<p dir="auto">I now am thinking I am missing an important issue here.</p>
<p dir="auto">Here is my project file:</p>
<pre><code>QT       += core gui sql

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17
LIBS += -lsqlUtitlities
INCLUDEPATH += /usr/local/include/

win32: LIBS += -L"C:\Software\Qt\MT47\MT47SW02\build\Desktop_Qt_6_10_2_MinGW_64_bit-Release\release" -llibsqlUtitlities
win32: INCLUDEPATH += "..\MT47SW02"
win32: LIBS += -L"C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib" -llibmariadb

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    commonsqlqueries.cpp \
    ecr.cpp \
    logindialogue.cpp \
    main.cpp \
    mainwindow.cpp \
    mutcodedialogue.cpp \
    mutcodesearch.cpp \
    tableexplorer.cpp

HEADERS += \
    commonsqlqueries.h \
    ecr.h \
    logindialogue.h \
    mainwindow.h \
    mutcodedialogue.h \
    mutcodesearch.h \
    tableexplorer.h

FORMS += \
    ecr.ui \
    logindialogue.ui \
    mainwindow.ui \
    mutcodedialogue.ui \
    mutcodesearch.ui \
    tableexplorer.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
</code></pre>
<p dir="auto">Anyone able to give me a nudge here as to what I am missing?</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.qt.io/topic/164501/getting-qsqlerror-driver-not-loaded</link><generator>RSS for Node</generator><lastBuildDate>Thu, 07 May 2026 08:26:15 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164501.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 30 Mar 2026 16:00:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Getting QSqlError &quot;Driver not loaded&quot; on Wed, 01 Apr 2026 12:01:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> said in <a href="/post/837477">Getting QSqlError "Driver not loaded"</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dibosco">@<bdi>DiBosco</bdi></a> said in <a href="/post/837475">Getting QSqlError "Driver not loaded"</a>:</p>
<blockquote>
<p dir="auto">just the mariadb libs.</p>
</blockquote>
<p dir="auto">Even this is not needed - you only need to compile the Qt sql plugin. The rest is already available as binary.</p>
</blockquote>
<p dir="auto">Yep, that's all I did. Sounds like I described it poorly.</p>
<p dir="auto">Am still intruiged as to why this has to be done on Windows, but not on Linux (or at least my Linux distro).</p>
]]></description><link>https://forum.qt.io/post/837480</link><guid isPermaLink="true">https://forum.qt.io/post/837480</guid><dc:creator><![CDATA[DiBosco]]></dc:creator><pubDate>Wed, 01 Apr 2026 12:01:29 GMT</pubDate></item><item><title><![CDATA[Reply to Getting QSqlError &quot;Driver not loaded&quot; on Wed, 01 Apr 2026 08:41:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dibosco">@<bdi>DiBosco</bdi></a> said in <a href="/post/837475">Getting QSqlError "Driver not loaded"</a>:</p>
<blockquote>
<p dir="auto">just the mariadb libs.</p>
</blockquote>
<p dir="auto">Even this is not needed - you only need to compile the Qt sql plugin. The rest is already available as binary.</p>
]]></description><link>https://forum.qt.io/post/837477</link><guid isPermaLink="true">https://forum.qt.io/post/837477</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 01 Apr 2026 08:41:44 GMT</pubDate></item><item><title><![CDATA[Reply to Getting QSqlError &quot;Driver not loaded&quot; on Wed, 01 Apr 2026 08:10:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dibosco">@<bdi>DiBosco</bdi></a> I think it's likely just a miscomprehension.</p>
<p dir="auto">We had many people trying to build the whole of Qt in place of just building the plugins they needed following the documentation.</p>
<p dir="auto">From the looks of it, you followed the right path but just had an issue with the compiler setup.</p>
]]></description><link>https://forum.qt.io/post/837476</link><guid isPermaLink="true">https://forum.qt.io/post/837476</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 01 Apr 2026 08:10:29 GMT</pubDate></item><item><title><![CDATA[Reply to Getting QSqlError &quot;Driver not loaded&quot; on Wed, 01 Apr 2026 12:27:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> said in <a href="/post/837468">Getting QSqlError "Driver not loaded"</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dibosco">@<bdi>DiBosco</bdi></a> said in <a href="/post/837465">Getting QSqlError "Driver not loaded"</a>:</p>
<blockquote>
<p dir="auto">Why do you have to compile on Windows when on Linux this just works?</p>
</blockquote>
<blockquote>
<p dir="auto">You have to build the Qt sql driver for MySQL by yourself for legal reasons</p>
</blockquote>
<p dir="auto">And there is no need to compile Qt by yourself. Mingw and msvc binaries are provided by the installer and the MySQL plugin compiles with both.</p>
</blockquote>
<p dir="auto">I'm not clear what you're saying here, Christian. I didn't compile the whole of Qt, just the mariadb libs. Or are you saying that what SGaist said wasn't quite right and there are binaries available? ie I did not have to compile mariadb libraries for Qt?</p>
]]></description><link>https://forum.qt.io/post/837475</link><guid isPermaLink="true">https://forum.qt.io/post/837475</guid><dc:creator><![CDATA[DiBosco]]></dc:creator><pubDate>Wed, 01 Apr 2026 12:27:46 GMT</pubDate></item><item><title><![CDATA[Reply to Getting QSqlError &quot;Driver not loaded&quot; on Wed, 01 Apr 2026 06:45:52 GMT]]></title><description><![CDATA[<p dir="auto">I use for PostgreSQL, maybe help you</p>
<pre><code>set(POSTGRESQL_DLL_DIR "C:/Program Files/PostgreSQL/17/bin")
foreach(dll IN ITEMS
    libpq.dll
    libssl-3-x64.dll
    libcrypto-3-x64.dll
    libiconv-2.dll
    libintl-9.dll
    libpgtypes.dll
    libwinpthread-1.dll
    libxml2.dll
    libxslt.dll
    libzstd.dll
    libcurl.dll
    libecpg.dll
    libecpg_compat.dll
    liblz4.dll
)
    add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy_if_different
            "${POSTGRESQL_DLL_DIR}/${dll}"
            $&lt;TARGET_FILE_DIR:${PROJECT_NAME}&gt;
    )
endforeach()
</code></pre>
]]></description><link>https://forum.qt.io/post/837472</link><guid isPermaLink="true">https://forum.qt.io/post/837472</guid><dc:creator><![CDATA[Joe von Habsburg]]></dc:creator><pubDate>Wed, 01 Apr 2026 06:45:52 GMT</pubDate></item><item><title><![CDATA[Reply to Getting QSqlError &quot;Driver not loaded&quot; on Wed, 01 Apr 2026 06:48:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dibosco">@<bdi>DiBosco</bdi></a> said in <a href="/post/837465">Getting QSqlError "Driver not loaded"</a>:</p>
<blockquote>
<p dir="auto">Why do you have to compile on Windows when on Linux this just works?</p>
</blockquote>
<blockquote>
<p dir="auto">You have to build the Qt sql driver for MySQL by yourself for legal reasons</p>
</blockquote>
<p dir="auto">And there is no need to compile Qt by yourself. Mingw and msvc binaries are provided by the installer and the MySQL plugin compiles with both.</p>
]]></description><link>https://forum.qt.io/post/837468</link><guid isPermaLink="true">https://forum.qt.io/post/837468</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 01 Apr 2026 06:48:23 GMT</pubDate></item><item><title><![CDATA[Reply to Getting QSqlError &quot;Driver not loaded&quot; on Tue, 31 Mar 2026 20:00:00 GMT]]></title><description><![CDATA[<p dir="auto">OK, thanks to everyone, I now have it compiled and running. It fought me. A lot.</p>
<p dir="auto">I had to install cmake, then ninja, then reboot. Then eventually worked out that I was trying to use Mingw parts with MSVC compiler, so rebuilt against Qt using Mingw as the compiler and it eventually worked.</p>
<p dir="auto">Uff, it's always easier on Linux! :D</p>
<p dir="auto">Why do you have to compile on Windows when on Linux this just works? None of this having to build libraries stuff!</p>
]]></description><link>https://forum.qt.io/post/837465</link><guid isPermaLink="true">https://forum.qt.io/post/837465</guid><dc:creator><![CDATA[DiBosco]]></dc:creator><pubDate>Tue, 31 Mar 2026 20:00:00 GMT</pubDate></item><item><title><![CDATA[Reply to Getting QSqlError &quot;Driver not loaded&quot; on Tue, 31 Mar 2026 11:42:17 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">You can put the build wherever you want outside of Qt's sources.</p>
<p dir="auto">The <code>&lt;qt_installation_path&gt;</code> is the root where you have Qt. In your case it seems to be <code>C:/Qt6</code>.</p>
<p dir="auto">You have to download the Qt sources that matches the version you want to build the driver for. You can do that through the Maintenance Tool.</p>
<p dir="auto"><code>platform</code> is what you have after <code>C:/Qt6/6.10.2</code></p>
<p dir="auto">It will create a plugin that will use the library you supplied.</p>
]]></description><link>https://forum.qt.io/post/837453</link><guid isPermaLink="true">https://forum.qt.io/post/837453</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 31 Mar 2026 11:42:17 GMT</pubDate></item><item><title><![CDATA[Reply to Getting QSqlError &quot;Driver not loaded&quot; on Tue, 31 Mar 2026 11:00:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> said in <a href="/post/837437">Getting QSqlError "Driver not loaded"</a>:</p>
<blockquote>
<p dir="auto">You have to build the Qt sql driver for MySQL by yourself for legal reasons as described here: <a href="https://doc.qt.io/qt-6/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows</a></p>
</blockquote>
<p dir="auto">I did see that and I'd [mis]understood it as saying DLLs were now being supplied.</p>
<p dir="auto">So, looking at this bit of info:</p>
<pre><code>mkdir build-sqldrivers
cd build-sqldrivers
qt-cmake -G Ninja &lt;qt_installation_path&gt;\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=&lt;qt_installation_path&gt;\&lt;platform&gt; -DMySQL_ROOT="C:\mysql-8.0.22-winx64"
cmake --build .
cmake --install .
</code></pre>
<p dir="auto">I have some questions about that.</p>
<p dir="auto">These two lines:</p>
<pre><code>mkdir build-sqldrivers
cd build-sqldrivers
</code></pre>
<p dir="auto">What directory are these new subdirectories to be put? Or does it not matter?</p>
<pre><code>qt-cmake -G Ninja &lt;qt_installation_path&gt;\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=&lt;qt_installation_path&gt;\&lt;platform&gt; -DMySQL_ROOT="C:\mysql-8.0.22-winx64"
</code></pre>
<p dir="auto">This &lt;qt_installation_path&gt; I am assuming is where that particular release of Qt lives. So in my case this is</p>
<p dir="auto">c:\Qt6\6.10.2</p>
<p dir="auto">However,  that does not have a source directory. So, do I have to download the Qt source here first?</p>
<pre><code>qt_installation_path&gt;\&lt;platform&gt;

</code></pre>
<p dir="auto">What is platform here?</p>
<pre><code>DMySQL_ROOT="C:\mysql-8.0.22-winx64
</code></pre>
<p dir="auto">Is this, for me:</p>
<p dir="auto">C:\Program Files\MariaDB\MariaDB Connector C 64-bit</p>
<p dir="auto">Where I have subdirectories:</p>
<p dir="auto">lib which has mariadb.dll</p>
<p dir="auto">And:</p>
<p dir="auto">include which has mysql.h</p>
<p dir="auto">And at the end of this, what will it actually create in terms of a DLL? Something like QMAriadb.dll or QMysql.dll and it's basically jiust a wrapper for the already supplied mariadb.dll?</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://forum.qt.io/post/837451</link><guid isPermaLink="true">https://forum.qt.io/post/837451</guid><dc:creator><![CDATA[DiBosco]]></dc:creator><pubDate>Tue, 31 Mar 2026 11:00:49 GMT</pubDate></item><item><title><![CDATA[Reply to Getting QSqlError &quot;Driver not loaded&quot; on Mon, 30 Mar 2026 16:02:50 GMT]]></title><description><![CDATA[<p dir="auto">You have to build the Qt sql driver for MySQL by yourself for legal reasons as described here: <a href="https://doc.qt.io/qt-6/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows</a></p>
]]></description><link>https://forum.qt.io/post/837437</link><guid isPermaLink="true">https://forum.qt.io/post/837437</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Mon, 30 Mar 2026 16:02:50 GMT</pubDate></item></channel></rss>