QODBC driver not loaded



  • So first of all I want to say I know there are many threads out there regarding this topic. But some of the solutions I found didn't work. And I didn't really understand the others. That's why I'm creating a new Thread.

    When I try to connect to a database using Qt I get an error saying

    @QSqlDatabase: QODBC driver not loaded
    QSqlDatabase: avaiable drivers: QSQLITE
    Error = QSqlError(-1, "Driver not loaded", "Driver not loaded")@

    I used the QtSDK Online installer to install Qt and QtCreator on Windows 7 x86 Professional.
    In many of the threads I've seen so far the people explained that I need to download the source and then compile it manually. But every thread I read had different "build-parameters" (the things with the "-" in front of them) so I don't know which ones to use. And if I tried any, I got error messages like "Qmake failed, return code 3" or somthing that mingw32-make returned an error code 1 and sometimes error code 2.
    Can anyone please tell me how to get QODBC to work?
    If you need any more information just tell me.
    Thanks in advance

    PS: Sorry if my english is not perfect (I am from Austria)


  • Moderators

    Have you read "this page in the docs about how to build it?":http://doc.qt.nokia.com/4.7/sql-driver.html#how-to-build-the-odbc-plugin-on-windows
    Sorry, I have to ask since you mention having read all the topics on this forum but you don't mention the docs ;).

    bq. How to Build the ODBC Plugin on Windows
    The ODBC header and include files should already be installed in the right directories. You just have to build the plugin as follows:
    @ cd %QTDIR%\src\plugins\sqldrivers\odbc
     qmake odbc.pro
     nmake@
    If you are not using a Microsoft compiler, replace nmake with make in the line above.

    Did you do that?



  • Yeah I tried that (I manually entered the QTDIR path (C:\QtSDK\QtSources\4.8.0 and I also tried 4.7.4 - is this the correct path?) because the %QTDIR% didn't work
    but the nmake didn't work so i used mingw32-make (on another forum someone said that this should work too) but this gave me an error. I just tried it again so I can show you the last few lines with the error code:

    @'C:\QtSDK\QtSources\4.8.0\bin\moc.exe' is not recognized as an internal or external command, operable program or batch file.
    mingw32-make[1]: *** [tmp/moc/debug_shared/moc_qsql_odbc.cpp] Error 1
    mingw32-make[1]: Leaving directory `C:/QtSDK/QtSources/4.8.0/src/plugins/sqldriv
    ers/odbc'
    mingw32-make: *** [debug-all] Error 2@


  • Moderators

    What if you go to your

    ...\src\plugins\sqldrivers\odbc

    And do the qmake and make there?

    You don't need QTDIR to use this. It's only a way to describe the path you need.



  • I already did it in this path: C:/QtSDK/QtSources/4.8.0/src/plugins/sqldrivers/odbc the time i showed you the error i got (my last post). The qmake doesn't give an error, just the mingw32-make. Is this the correct path?



  • Ok time for an update!
    The nmake worked when I used the Windows sdk cmd shell.
    so i tried building it from source, but it didn't work... (it compiled - for 16 hrs and with many warnings - but qt creator couldn't find the paths to qmake and all the includes/libs)
    Then I tried installing it with the installer and then just building the plugin (nmake works with the windows sdk cmd shell) and it was built successfully, but qt creator still can't find the plugin.
    So thats all I have for now. If you have any idea what I can try... please tell me :)



  • Did you find any solution for your problem, Coz I am facing it right now?



  • Unfortunately I still don't know how to solve this problem. I decided to wait until the next Qt version gets released because I got tired of looking through all that posts in all kinds of forums. I hope they will release a new version soon. Tomorrow I'll try it again on a different computer. Maybe even a different OS and if it works it must be the OS (Windows 7 x86). I'll post again if I get any new ideas/solutions. And I hope if you find a solution you'll tell me (and everyone else who had or will have this problem).


Log in to reply
 

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