Where is the SQL database plugin for ODBC (qsqlodbc.dll) in Qt 5.6 ?
It looks like the SQL database plugin for ODBC (qsqlodbc.dll) is missing from the standard Qt 5.6 installer for Windows you download from https://www.qt.io/download-open-source.
You’d expect to find it in
C:\Qt\Qt5.6.0\5.6\msvc2015_64\plugins\sqldrivers\ where the sqlite, mysql and postgresql ones are found, but the ODBC plugin is not there.
The issue is known (see QTBUG-49420 and QTBUG-51390) but these bug reports are closed and it seems there will be no fix on a short term.
So here is how you build qsqlodbc.dll from source for Windows 64-bit with Visual Studio 2015, based on the instructions “How to Build the ODBC Plugin on Windows”.
First get the source package qt-everywhere-opensource-src-5.6.0.zip from https://download.qt.io/archive/qt/ and unzip it in any location, for example
Now open a “VS2015 x64 native tools command prompt”, CD to the location of the qt-everywhere-opensource-src-5.6.0 directory then:
cd qtbase\src\plugins\sqldrivers\odbc C:\Qt\Qt5.6.0\5.6\msvc2015_64\bin\qmake odbc.pro nmake
At the end you’ll find the qsqlodbc.dll in
C:\qt-everywhere-opensource-src-5.6.0\qtbase\plugins\sqldrivers alogside with qsqlodbcd.dll and qsqlodbcd.pdb.
Just copy these three files to the location where the Qt 5.6 installer for Windows should have put them
C:\Qt\Qt5.6.0\5.6\msvc2015_64\plugins\sqldrivers\ and you’ll be done !