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. Mysql plugin generated but cannot be loaded
Forum Updated to NodeBB v4.3 + New Features

Mysql plugin generated but cannot be loaded

Scheduled Pinned Locked Moved Installation and Deployment
7 Posts 3 Posters 3.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.
  • H Offline
    H Offline
    helloworld
    wrote on last edited by
    #1

    Hi guys, I'm new to QT. Im using the latest QT IDE at the moment (Qt Creator version 2.1, QT 4.7.3). I have compiled mysql plugin and generated qsqlmysqld4.dll and qsqlmysql4.dll. But when I ran the program, I got the error "Driver not loaded". From the application output, I got the information :

    QSqlDatabase: available drivers: QSQLITE

    So I know it means mysql driver is not available for my program but i don't know why. And how can I make it available here.
    I have copied the file qsqlmysqld4.dll and qsqlmysql4.dll to the following path:
    D:\QtSDK\Desktop\Qt\4.7.3\mingw\plugins\sqldrivers
    I have also copied the file libmysql.dll to:
    D:\QtSDK\Desktop\Qt\4.7.3\mingw\bin

    Thanks in advance!

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

      Try putting libmysql.dll in your global PATH in Control Panel/System/Advanced System Settings/Environment variables, then restart Qt Creator. Does that help? Alternatively, you can try putting libmysql.dll in the same folder as the Qt dlls in yourQtDirectory/bin.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        helloworld
        wrote on last edited by
        #3

        [quote author="sigrid" date="1304670651"]Try putting libmysql.dll in your global PATH in Control Panel/System/Advanced System Settings/Environment variables, then restart Qt Creator. Does that help? Alternatively, you can try putting libmysql.dll in the same folder as the Qt dlls in yourQtDirectory/bin. [/quote]

        Thank you very much for your reply. I put the libmysql.dll to my executable file folder and it is now working. But I wonder why it dosen't work when I put it in D:\QtSDK\Desktop\Qt\4.7.3\mingw\bin, where this path is in system environment variable PATH.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          doobinay
          wrote on last edited by
          #4

          May I ask how did you compile the MySQL driver for Qt Creator 4.7.3 ?

          I can only find tutorials for old versions...

          That would be kind !

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

            bq. Thank you very much for your reply. I put the libmysql.dll to my executable file folder and it is now working. But I wonder why it dosen’t work when I put it in D:\QtSDK\Desktop\Qt\4.7.3\mingw\bin, where this path is in system environment variable PATH.

            This seems to be caused by the following bug:

            http://bugreports.qt.nokia.com/browse/QTBUG-18003

            where the qtvars.bat overrides the global PATH and causes your modifications to the PATH to be ignored.

            1 Reply Last reply
            0
            • H Offline
              H Offline
              helloworld
              wrote on last edited by
              #6

              [quote author="doobinay" date="1305005095"]May I ask how did you compile the MySQL driver for Qt Creator 4.7.3 ?

              I can only find tutorials for old versions...

              That would be kind ![/quote]

              Building mysql driver for the old versions is actually quite similar to the new version. The latest qt sdk separates the files for mingw and visual studio.net environments. If you use mingw as your compiler, QtSDK\Desktop\Qt\4.7.3\mingw is your "QTDIR". Keep this in mind and follow the old tutorial and you will get the mysql driver compiled.

              1 Reply Last reply
              0
              • H Offline
                H Offline
                helloworld
                wrote on last edited by
                #7

                [quote author="sigrid" date="1305010321"]bq. Thank you very much for your reply. I put the libmysql.dll to my executable file folder and it is now working. But I wonder why it dosen’t work when I put it in D:\QtSDK\Desktop\Qt\4.7.3\mingw\bin, where this path is in system environment variable PATH.

                This seems to be caused by the following bug:

                http://bugreports.qt.nokia.com/browse/QTBUG-18003

                where the qtvars.bat overrides the global PATH and causes your modifications to the PATH to be ignored.[/quote]

                Thanks again for all your help!

                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