Important: Please read the Qt Code of Conduct -

Problem with loading SQL Drivers

  • I build app in Mac OS X with PostgreSQL, so I used QPSQL driver.
    But when I build app for Windows I use MSSQL and QODBC driver.
    In the Settings window ( user can set some attributes for connection. On Mac I can connect to db, and do everything that I need.
    But when we build app for Win, we see:
    QSqlDatabase: driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
    Something wrong with db openning hey!
    QSqlError(-1, "Driver not loaded", "Driver not loaded")

    Also we write: QApplication::addLibraryPath("C:\Qt\5.1.1\Src\qtbase\src\plugins");
    but it doesn't help.

  • Lifetime Qt Champion


    Do you have the plugin dll dependencies in your PATH ?

  • Hi,
    actually we build Qt with -static key. And want to get static build app without any .dll. Is it possible?
    [quote author="SGaist" date="1380635914"]Hi,

    Do you have the plugin dll dependencies in your PATH ?[/quote]

  • Lifetime Qt Champion

    AFAIK it should be, but you would also need to link to the static version of your dependencies (e.g. you sql plugins)

    The plugins can be static but linked to the dynamic library of e.g. mysql.

    Also, don't forget the licensing implication of a static build

Log in to reply