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. I have problems with QMYSQL Driver!
Forum Updated to NodeBB v4.3 + New Features

I have problems with QMYSQL Driver!

Scheduled Pinned Locked Moved General and Desktop
40 Posts 6 Posters 17.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.
  • K Offline
    K Offline
    kaloo
    wrote on last edited by
    #18

    Thanks for your help.

    At the begin there is no mysql folder, but I made a new project named mysql and put it in the sqldrives. That is what should I do? Or I did it wrong?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #19

      There is (or at least should be) a mysql.pro file in your Qt sources. If there isn't, you either are not looking hard enough, or you have an incomplete installation of the Qt sources. The former is more likely. Just making up a .pro file yourself is obviously not going to result in a valid project that is going to help you build the drivers.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kaloo
        wrote on last edited by
        #20

        Andre I think I found the mysql.pro through the source files. Ill try tomorrow to make the QMYSQL Driver. If Ill have any problems, I`ll make a reply tomorrow.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kaloo
          wrote on last edited by
          #21

          I found the right mysql.pro, I tiped
          @
          qmake "INCLUDE+=C:..." "LIBS+=C:...\libmysql.a" -o Makefile mysql.pro
          mingw32-make
          @

          then I got !http://img651.imageshack.us/img651/614/unledswx.png!
          Where is the problem?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #22

            Did you prepare the MySql libs for use with the MinGw compiler, as is described in the countless other topics you claimed to have read on this issue?

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kaloo
              wrote on last edited by
              #23

              Yes I did. I crated the libmysql.a

              1 Reply Last reply
              0
              • C Offline
                C Offline
                cincirin
                wrote on last edited by
                #24

                @kallo here are the steps to build mysql plug-in driver ( and I assure you it works :-) ):

                1. download mysql-connector-c-noinstall-6.0.2-win32 binary package from mysql downloads.
                2. open %QTDIR%\src\plugins\sqldrivers\mysql\mysql.pro in QtCreator
                3. add LIBS and INCLUDEPATH in mysql.pro to match with your mysql-connector-c-noinstall-6.0.2-win32 path
                4. after mysql.pro is succesfully build, copy the qsqlmysqld4.dll + qsqlmysql4.dll in %QTDIR%\Desktop...etc...\plugins\sqldrivers (there should already be qsqlite4.dll)
                5. copy libmysql.dll in %QTDIR%\Desktop...etc...\bin

                that's all

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #25

                  No cincirin, that is not all. It depends on your toolchain. If you use minGw, as kaloo is doing, you need some additional steps.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    cincirin
                    wrote on last edited by
                    #26

                    I use mingw toolchain and they work.

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kaloo
                      wrote on last edited by
                      #27

                      So I did how cincirin said
                      !http://img51.imageshack.us/img51/5876/unledcj.png!

                      the output says
                      @
                      cannot find -libmysql
                      @

                      Where should libmysql stay? or what I did wrong?

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        cincirin
                        wrote on last edited by
                        #28

                        Do you have libmysql*.a* ? Don't you have libmysql.lib ?
                        Also you have to put only the path to libmysql.lib LIBS += yourPath

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          kaloo
                          wrote on last edited by
                          #29

                          I have libmysql.a

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            cincirin
                            wrote on last edited by
                            #30

                            From what I see, you didn't download mysql conector binary builds. Your path is towards xampp/...

                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              kaloo
                              wrote on last edited by
                              #31

                              I have mysql-connector-c-noinstall-6.0.2-win32, extracted in the xampp/mysql folder

                              edit:
                              if I put
                              @
                              INCLUDEPATH += C:/xampp/mysql/include
                              LIBS += C:/xampp/mysql/lib/libmysql.a@
                              before
                              @
                              include(../../../sql/drivers/mysql/qsql_mysql.pri)
                              include(../qsqldriverbase.pri)
                              @
                              The output gives me 83 errors with undefined reference

                              1 Reply Last reply
                              0
                              • C Offline
                                C Offline
                                cincirin
                                wrote on last edited by
                                #32

                                Ok, then your project should look as: ... LIBS += c:/xampp/mysql/lib
                                Anyway, I don't have libmysql*.a*

                                1 Reply Last reply
                                0
                                • K Offline
                                  K Offline
                                  kaloo
                                  wrote on last edited by
                                  #33

                                  I created the libmysql.a with
                                  @ reimp C:/xampp/mysql/lib/libmysql.lib @

                                  1 Reply Last reply
                                  0
                                  • C Offline
                                    C Offline
                                    cincirin
                                    wrote on last edited by
                                    #34

                                    You have to put only the path to mysql lib directory, because qsql_mysql.pri already do: LIBS += -llibmysql
                                    Did you try with LIBS += -Lc:/xampp/mysql/lib ?

                                    1 Reply Last reply
                                    0
                                    • K Offline
                                      K Offline
                                      kaloo
                                      wrote on last edited by
                                      #35

                                      the mysql.pro is now:
                                      @
                                      TARGET = qsqlmysql

                                      SOURCES = main.cpp

                                      INCLUDEPATH += C:/xampp/mysql/include
                                      LIBS += C:/xampp/mysql/lib

                                      include(../../../sql/drivers/mysql/qsql_mysql.pri)
                                      include(../qsqldriverbase.pri)
                                      @

                                      and the output sais
                                      @
                                      C:/xampp/mysql/lib No such file: Permission Denied
                                      @

                                      but the folder is not read only... I don`t know what to do...

                                      1 Reply Last reply
                                      0
                                      • C Offline
                                        C Offline
                                        cincirin
                                        wrote on last edited by
                                        #36

                                        Your project should be:
                                        @
                                        TARGET = qsqlmysql

                                        SOURCES = main.cpp
                                        include(../../../sql/drivers/mysql/qsql_mysql.pri)

                                        include(../qsqldriverbase.pri)

                                        INCLUDEPATH = C:/xampp/mysql/include
                                        LIBS += -LC:/xampp/mysql/lib
                                        @

                                        1 Reply Last reply
                                        0
                                        • K Offline
                                          K Offline
                                          kaloo
                                          wrote on last edited by
                                          #37

                                          Yes, now is
                                          @
                                          TARGET = qsqlmysql

                                          SOURCES = main.cpp
                                          include(../../../sql/drivers/mysql/qsql_mysql.pri)

                                          include(../qsqldriverbase.pri)

                                          INCLUDEPATH = C:/xampp/mysql/include
                                          LIBS += -LC:/xampp/mysql/lib
                                          @
                                          but again
                                          @
                                          cannot find -libmysql
                                          @

                                          Where should be that file? in the lib folder of mysql?

                                          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