what do i need library when release application with QODBC



  • Win7+Qt5.6+SQL Server 2005

    source:
    db = QSqlDatabase::addDatabase("QODBC");
    db.setDatabaseName(QString("DRIVER={SQL SERVER};"
    "SERVER=%1;"
    "DATABASE=%2;"
    "UID=%3;"
    "PWD=%4;")
    .arg("")
    .arg("
    ")
    .arg("sa")
    .arg("123456"));

    when i debug/release it with Qt Creator, it's ok.

    but when i realse it, and run with Qt's dll, some message on console

    Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use:
    QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-screen factors.
    QT_SCREEN_SCALE_FACTORS to set per-screen factors.
    QT_SCALE_FACTOR to set the application global scale factor.
    QSqlDatabase: QODBC driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    QSqlQuery::exec: database not open



  • Hi, Qt 5.6 didn't have the ODBC plugin file (qsqlodbc.dll) that's probably why the ODBC driver doesn't load for you.
    You could try upgrading to Qt 5.6.1 or Qt 5.7, in those releases qsqlodbc.dll is correctly included.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.