Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QODBC driver not loaded
QtWS25 Last Chance

QODBC driver not loaded

Scheduled Pinned Locked Moved Installation and Deployment
8 Posts 3 Posters 7.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lboy94
    wrote on last edited by
    #1

    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)

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      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?

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lboy94
        wrote on last edited by
        #3

        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@

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          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.

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lboy94
            wrote on last edited by
            #5

            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?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lboy94
              wrote on last edited by
              #6

              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 :)

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mismail
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lboy94
                  wrote on last edited by
                  #8

                  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).

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved