Important: Please read the Qt Code of Conduct -

Qt5 - QODBC driver not loaded error even though ODBC driver is available

  • Hi,
    I am trying to use ODBC driver in my Qt 5.0 project.

    I compiled QODBC driver and copied the driver dlls to the Qt\Qt5.0.0\5.0.0\msvc2010\plugins\sqldrivers folder.

    When I try the following code.
    @ QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");@

    I get the following error:
    QSqlDatabase: QODBC driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3

    Same error is encountered if I tried loading QODBC3 .

    Even though QODBC and QODBC3 drivers are present, Qt still could not load QODBC driver.

    I am running Windows 7 (64 bit) PC.

    Has anybody encountered such error? Any clues on what might be wrong ?

  • You need to copy qsqlodbc.dll in APP_DIR/sqldrivers folder where APP_DIR is your application executable path.

  • Thanks, that helped.

Log in to reply