Issue with QSqlDatabase::addDatabase(“QODBC”) Qt 4.8.4



  • Im trying to connect to a remote SQL Server database. When trying to add "QODBC" as my QSqlDatabase, I get the following error on the runtime:

    My Code snippet:

    @QStringList drivers = QSqlDatabase::drivers();
    qDebug()<<"drivers list: "<<drivers;
    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");@

    Error/Console output:
    @drivers list: ("QODBC3", "QODBC")
    Cannot mix incompatible Qt library (version 0x40804) with this library (version 0x40803)@

    As you can see the output of my drivers list shows that I have the drivers available. The .pro file has "QT += sql", I have followed the instructions on QT support blog to build the odbc drivers and added them to my application folder as "sqldrivers" sub folder. I can't seem to find how do I solve the Version Incompatibility error. Any help in resolving this issue will be appreciated, thanks.



  • Do you have on your system another version of Qt?



  • No there is only one installation & that is 4.8.4.



  • Solved it: looks like the QtCore & QtGui dll's in the application folder was not the same version as of the Qsqlodbc.dll, added the same version dll's and it worked.


Log in to reply
 

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