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. Problem using Mysql driver

Problem using Mysql driver

Scheduled Pinned Locked Moved Installation and Deployment
11 Posts 5 Posters 9.2k 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
    harryF
    wrote on last edited by
    #2

    set the environment variable QT_DEBUG_PLUGINS to 1, what kind of output do you get?

    // happy hacking

    1 Reply Last reply
    0
    • E Offline
      E Offline
      evanxg852000
      wrote on last edited by
      #3

      as you said I ahev done that now using this

      @#include <QtGui/QApplication>
      #include <QtSql>

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);

      QSqlDatabase::addDatabase("MYSQL");
      
      
      return a.exec&#40;&#41;;
      

      }
      @

      I am getting this error now :

      Starting C:\Users\Administrator\Desktop\testger-build-desktop\release\testger.exe...
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlite4.a"
      "The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlite4.a' is not a valid Qt plugin."
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlited4.a"
      "The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlited4.a' is not a valid Qt plugin."
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysql4.a"
      "The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysql4.a' is not a valid Qt plugin."
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysqld4.a"
      "The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysqld4.a' is not a valid Qt plugin."
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbc4.a"
      "The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbc4.a' is not a valid Qt plugin."
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbcd4.a"
      "The file 'C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbcd4.a' is not a valid Qt plugin."
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlite4.dll"
      keys ("QSQLITE")
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlited4.dll"
      "The plugin 'C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlited4.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlmysql4.dll"
      keys ("QMYSQL3", "QMYSQL")
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlmysqld4.dll"
      "The plugin 'C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlmysqld4.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"
      not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlodbc4.dll"
      keys ("QODBC3", "QODBC")
      QFactoryLoader::QFactoryLoader() looking at "C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlodbcd4.dll"
      "The plugin 'C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlodbcd4.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"
      not a plugin
      QSqlDatabase: MYSQL driver not loaded
      QSqlDatabase: available drivers: QSQLITE QMYSQL3 QMYSQL QODBC3 QODBC

      Evan-XG

      1 Reply Last reply
      0
      • H Offline
        H Offline
        harryF
        wrote on last edited by
        #4

        The driver name for the Qt MySQL driver is "QMYSQL", not "MYSQL".

        // happy hacking

        1 Reply Last reply
        0
        • E Offline
          E Offline
          evanxg852000
          wrote on last edited by
          #5

          change it but the same output

          Evan-XG

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DenisKormalev
            wrote on last edited by
            #6

            Output in your last post is simply a debug and it is ok that it contains all this strings. Is behavior changed or still database is unavailable?

            1 Reply Last reply
            0
            • E Offline
              E Offline
              evanxg852000
              wrote on last edited by
              #7

              surprisingly it's come up . thanks a lot but i think they are subtle things going on . thanks very much

              Evan-XG

              1 Reply Last reply
              0
              • R Offline
                R Offline
                red_eye
                wrote on last edited by
                #8

                I too am struggling with the QMYSQL driver issue in building a Windoze application. A first with Qt 4.6 commercial & VS 2008, I follow the plugin instrictions in Assistant, the "driver is not loaded" and the Assistant says it's usually an issue with the build key. Perhaps someone could suggest a solution to this.

                In Linux I recompiled the Qt source with Mysql in the configuration or something like that, and life was good. Do I have to do the same in Winblows too?

                This shouldn't be so difficult. Come on Qt experts, let go of the little details please.

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  evanxg852000
                  wrote on last edited by
                  #9

                  I solved mine on a french source. I used qt creator to built on the commande line. but really this drivers gives some unexpected result from time to time . i succed to built and test it, 2 days later i tried to work on my project it wsa not working any more . my source is "Here":http://giminik.developpez.com/articles/C++-Qt4/installation-mysql-firebird-openssl/

                  its in french but to summarize . you need to install mysql with the header files .

                  assuming u have Mingw install do this on cammand line

                  @cd C:\MySQL-5.0\lib\opt
                  reimp -d libmysql.lib@

                  note sometimes reimp is not in your mingw bin folder, so u need "Download":ftp://ftp-developpez.com/giminik/C++/Qt4/installation-mysql-firebird-openssl/mingw-utils-0.3.tar.gz

                  or in mingw utilities folder from sourgeforge.net

                  after u need to do this @dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a@ this process is to make the lib file compatible with mingw implementation.
                  now u ill need to compile the mysql driver by linking to the lib file that was created in the last process . it is the as in the documentation, but to make u'r life easier i would recomand u to use qt command line tool Mingw . if for some reason u d'ont want there is always a way around. just beaware that compiling with eithercompiler can bring your error. my solution was to clean up everithing and compile again

                  Evan-XG

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    s.frings
                    wrote on last edited by
                    #10

                    After upgrade to QT 4.7 on windows, I encountered a new problem which I did not have previously: reimp 0.3 and also 0.41 does not work with current version 6.02 of libmysql.dll:

                    reimp -d libmysql.dll
                    reimp: libmysql.dll: invalid or corrupt import library

                    How can I compile the mysql plugin now?

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      s.frings
                      wrote on last edited by
                      #11

                      My error was that I tried to run reimp on the dll file, but I should use the lib file instead. Oops!

                      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