Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qodbc driver not loaded

Qodbc driver not loaded

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.9k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    Schubi
    wrote on last edited by
    #1

    Hi i try to create a dll witch connects over ODBC to a microsoft SQL Database. I create and use the dll in VisualStudio projects.
    But i get the error QODBC driver not loaded.

    I had a simular problam as i tried to create an exe witch connects to a DB over ODBC and execute it on a machine without QT installation. There was the solution to create a folder in the path of the exe called sqldrivers and in it the needed dll qsqlodbc4.dll.

    I think the problem is that the dll needs the qsqlodbcd4.dll but i don´t know how to include this in my project.
    I tried it this way
    @QLibrary lib(QLatin1String("C:\Programme\DEMCenter\bin\sqldrivers\qsqlodbcd4.dll"));
    if(lib.load())
    {
    QtPluginInstanceFunction pInstanceFct = 0;
    QObject* pAccPlugin = 0;
    pInstanceFct = (QtPluginInstanceFunction)lib.resolve("qt_plugin_instance");

    if(0 != pInstanceFct)
    {
    RegisterStaticPluginInstanceFunction(pInstanceFct);
    }
    }
    else
    INFO("dllNOT LOADED");@

    But it dosn´t work it runs everytime in the else and tell me that the dll is not loaded

    Hope someone can help me

    THX
    Schubi

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Schubi
      wrote on last edited by
      #2

      This is the error message i become when i try to connect to the odbc database

      QSqlDatabase: QODBC driver not loaded
      QSqlDatabase: available drivers:
      QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins

      1 Reply Last reply
      0
      • F Offline
        F Offline
        franku
        wrote on last edited by
        #3

        How did you setup the application where your dll failes? Try to make a minimal program that loads your SQLdll. Normally there's no need to load the plugin driver manually.

        This, Jen, is the internet.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Schubi
          wrote on last edited by
          #4

          Hi I tried it with a smal programm. When I run the programm with the dll on a maschine where QT is installed everythink runs fine. But when i run the programm on a pc without a qt installation i can´t connect to the database.

          I although tried to connect to the database in a programm without a dll. On the pc with qt everythink runs fine. On the maschine without qt i had to copy the qsqlodbc4.dll and after that it worked.

          So i gues i need to load the qsqlodbc4.dll manually that my dll can find the plugin but i don´t know how to do it

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Schubi
            wrote on last edited by
            #5

            Hi again.

            No one an idear? I tried to fix the Problem. But i can´t finde a solution. Is there a way to set the path to the plugin folder? To set QTPATH is not working
            I found ways to it inside a normal QT project but not in an dll.

            The reason why my dll works on a maschine where qt is installed is that in QTCore4.dll qt_plugpath=D:\Qt\4.8.2\plugins is set where my qt plugins are.
            But on the maschine where my project should run is no QT installation an no d:\

            THX

            Schubi

            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