Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Odbc driver - can't get it work



  • I have MS SQL Server 2008 R2 installed in my PC and I want to connect my qt application to it but when I do:
    @qDebug() << QSqlDatabase::drivers();@

    it only return ("QSQLITE"). I read in the "documentation":http://doc.qt.nokia.com/4.7-snapshot/sql-driver.html that I need to compile the plugin but I can't get it work.

    It appear to have the dll:
    C:\QtSDK\Desktop\Qt\4.8.1\mingw\plugins\sqldrivers>dir
    Volume in drive C has no label.
    Volume Serial Number is 94CE-CCA3

    Directory of C:\QtSDK\Desktop\Qt\4.8.1\mingw\plugins\sqldrivers

    27-05-2012 18:58 <DIR> .
    27-05-2012 18:58 <DIR> ..
    27-05-2012 18:57 527.360 qsqlite4.dll
    27-05-2012 18:57 1.872.165 qsqlited4.dll
    27-05-2012 18:57 163.840 qsqlodbc4.dll
    27-05-2012 18:57 997.135 qsqlodbcd4.dll
    4 File(s) 3.560.500 bytes
    2 Dir(s) 79.757.148.160 bytes free

    I tried to run:
    C:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\odbc>qmake odbc.pro

    C:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\odbc>nmake
    'nmake' is not recognized as an internal or external command,
    operable program or batch file.

    C:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\odbc>make
    'make' is not recognized as an internal or external command,
    operable program or batch file.

    C:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\odbc>

    CAn you help me?

    Thanks :s



  • "nmake" is the make utility for the Microsoft C++ tool chain. You are, presumably, using the bundled MingW compiler. The equivalent command is:
    @mingw32-make @

    You will also need to run:
    @ mingw32-make install @

    after it is built to install the plugin. If you want a release version of the plugin you should repeat the qmake command with "CONFIG+=release" as an extra argument, make, and install.



  • Thanks :) Works great :)


Log in to reply