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. error while connection to Database

error while connection to Database

Scheduled Pinned Locked Moved Solved General and Desktop
16 Posts 3 Posters 5.6k 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.
  • raven-worxR raven-worx

    @Allerknappe said in error while connection to Database:

    i get this error in the first line of the code

    i would say the crash is not related to the lines of code you've posted.
    How do you know it's that line of code? Did you run it in the debugger?

    A missing mysql lib won't cause a seg fault. It would just prevent the plugin from being loaded successfully, but it wouldn't cause a crash.

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #4

    @raven-worx said in error while connection to Database:

    @Allerknappe said in error while connection to Database:

    i get this error in the first line of the code

    i would say the crash is not related to the lines of code you've posted.
    How do you know it's that line of code? Did you run it in the debugger?

    A missing mysql lib won't cause a seg fault. It would just prevent the plugin from being loaded successfully, but it wouldn't cause a crash.

    The OP stated "i get this error in the first line of the code", so I took him at his word! :) Anyway a back trace in gdb should confirm.

    A missing mysqllib etc. may not crash, but the wrong/inconsistent versions of the necessary libmysqlqt or whatever it's called and other libraries under Linux can do, in my experience... :)

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Allerknappe
      wrote on last edited by
      #5

      ok thanks for the fast answers,

      i see now that i have skipped the section with the QMYSQL driver so that i never have installed some driver :( ...
      now i tried the description from here sql-driver but how so often i think i do something wrong.
      i loaded the mysql installer for the needed .lib and then i try to run:

      cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql
      qmake "INCLUDEPATH+=C:/mysql/MySQL/MySQLConnector.C6.1/include" "LIBS+=C:/mysql/MySQL/MySQLServer5.7/lib/libmysql.lib" mysql.pro
      make

      After this i try to set my configure for the mysql database :
      c:\qt\5.9.1\Src>configure -sql-mysql

      but i still get the error: ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.

      you have some experience with my problem?

      thanks a lot

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Allerknappe
        wrote on last edited by
        #6

        so i tried this:
        *
        ****Works for me on Windows with Qt SDK 5.6.0 (32bit version with mingw 4.9.2 32bit included) :

        • Downloaded MySQL 32bit in zip archive (mine was v5.7.11)
        • Extracted it to C:/MySQL
        • Copied "C:\Qt\QMySQL\lib\libmysql.dll" and "C:\Qt\QMySQL\lib\libmysqld.dll" to Windows/System32 (to avoid the "cannot found -llibmysql" compilation error)
        • Compile with "How to Build the QMYSQL Plugin on Windows" on http://doc.qt.io/qt-5/sql-driver.html#qmysql (my command was "qmake "INCLUDEPATH+=C:\Qt\QMySQL\include" "LIBS+=C:\Qt\QMySQL\lib\libmysql.lib" sql.pro" and "mingw32-make")
        • After compilation succeeded, copy (the freshly compiled) Qt5Sql.dll & Qt5Sqld.dll from "C:\Qt\Qt5.6.0\5.6\Src\qtbase\lib" to your application build directory
        • Restart QtCreator, that should work*****

        but when i run the cmd with this statements i get this outline:

        **C:\qt\5.9.1\mingw53_32>cd C:\qt\5.9.1\Src\qtbase\src\plugins\sqldrivers\mysql

        C:\qt\5.9.1\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\mysql\MySQL\MySQLConnector.C6.1\include" "LIBS+=C:\mysql\MySQL\MySQLConnector.C6.1\lib\libmysql.lib" mysql.pro

        C:\qt\5.9.1\Src\qtbase\src\plugins\sqldrivers\mysql>make
        make -f Makefile.Release all
        make[1]: Entering directory 'C:/qt/5.9.1/Src/qtbase/src/plugins/sqldrivers/mysql'
        make[1]: Nothing to be done for 'all'.
        make[1]: Leaving directory 'C:/qt/5.9.1/Src/qtbase/src/plugins/sqldrivers/mysql'
        make -f Makefile.Debug all
        make[1]: Entering directory 'C:/qt/5.9.1/Src/qtbase/src/plugins/sqldrivers/mysql'
        make[1]: Nothing to be done for 'all'.
        make[1]: Leaving directory 'C:/qt/5.9.1/Src/qtbase/src/plugins/sqldrivers/mysql'**

        the C:\qt\5.9.1\Src\qtbase\lib directory is also empty so that only the README said, that i´m probably forget to compile the qt library, and yes i never compile something i only install qt and compile in the creator my code.

        some help?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Allerknappe
          wrote on last edited by
          #7

          ok now i run all the process from this http://doc.qt.io/qt-5/windows-building.html website.
          Everything seems ok, but still i get the error:
          ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
          maybe some help`?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Allerknappe
            wrote on last edited by
            #8

            So i tried new things:
            i do all the things in the win cmd. it propably worked all well, till the end:
            configure -debug -nomake examples -opensource #done
            make #done
            make install #done
            cd C:\mysql\MySQL\MySQLConnector.C6.1\lib #done
            reimp -d libmysql.lib #done
            dlltool -k -d libmysql.def -l libmysql.a #done
            cd C:\qt\5.9.1\Src #done
            configure -I C:\mysql\MySQL\MySQLConnector.C6.1\include -L C:\mysql\MySQL\MySQLConnector.C6.1\lib #done
            make sub-src #done
            make install #done
            cd C:\qt\5.9.1\Src\qtbase\src\plugins\sqldrivers\mysql
            qmake "INCLUDEPATH+=C:\mysql\MySQL\MySQLConnector.C6.1\include" "LIBS+=-L. mysql" mysql.pro
            make

            the make statement gives me the following error:

            ql_mysql_p.o -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib -L. mysql -LC:\qt\5.9.1\Src\qtbase\lib C:\qt\5.9.1\Src\qtbase\lib\libQt5Sql.a C:\qt\5.9.1\Src\qtbase\lib\libQt5Core.a .obj\release\qsqlmysql_resource_res.o
            g++: error: mysql: No such file or directory
            Makefile.Release:67: recipe for target 'C:\qt\5.9.1\Src\qtbase\plugins\sqldrivers\qsqlmysql.dll' failed
            make[1]: *** [C:\qt\5.9.1\Src\qtbase\plugins\sqldrivers\qsqlmysql.dll] Error 1
            make[1]: Leaving directory 'C:/qt/5.9.1/Src/qtbase/src/plugins/sqldrivers/mysql'
            Makefile:40: recipe for target 'release-all' failed

            i have also find in the qt4.9 description additional these steps after my end:

            Now the following libraries are ready in C:\Qt\4.6.2\plugins\sqldrivers.

            libqsqlmysql4.a
            libqsqlmysqld4.a
            qsqlmysql4.dll
            qsqlmysqld4.dll
            

            ok i dont have the 4 at the end of the filename but i find the qsqlmysqld but not the qsqlmysql.dll , it seems that this file will not creat. But why?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Allerknappe
              wrote on last edited by
              #9

              so i try to install qt 5.9.2 new .
              have someone a step-by-step installation guide from a new installation to a working mysql plugin ?

              JonBJ 1 Reply Last reply
              0
              • A Allerknappe

                so i try to install qt 5.9.2 new .
                have someone a step-by-step installation guide from a new installation to a working mysql plugin ?

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #10

                @Allerknappe

                Now the following libraries are ready in C:\Qt\4.6.2\plugins\sqldrivers.

                Sorry, you seem to be saying either you have Qt4 SQL drivers for your Qt5 build, or you have Qt5 drivers but you've placed them in a directory named for Qt4 which I would guess is not looked at by Qt5??

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  Allerknappe
                  wrote on last edited by
                  #11

                  yes in my frustration i tried the installation guide How to Build the QMYSQL Plugin on Windows from the qt 4.9 part. i now that i use 5.9.1 but the 5.9 installation guide seems not to be working... so i tried the other guide and only change the 4.9 path to 5.9

                  JonBJ 1 Reply Last reply
                  0
                  • A Allerknappe

                    yes in my frustration i tried the installation guide How to Build the QMYSQL Plugin on Windows from the qt 4.9 part. i now that i use 5.9.1 but the 5.9 installation guide seems not to be working... so i tried the other guide and only change the 4.9 path to 5.9

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #12

                    @Allerknappe said in error while connection to Database:

                    and only change the 4.9 path to 5.9

                    Earlier you wrote:

                    Now the following libraries are ready in C:\Qt\4.6.2\plugins\sqldrivers

                    I leave you to verify your paths and that they are being searched correctly for 5.9.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      Allerknappe
                      wrote on last edited by
                      #13

                      yeah sorry for the mistake i copied from a other side where the path was for 4.9 , for me i changed the path to 5.9

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        Allerknappe
                        wrote on last edited by
                        #14

                        ok, how i solve this problem :

                        C:\qt\5.9.2\Src\qtlocation\src\3rdparty\mapbox-gl-native/src/mbgl/gl/value.cpp:185: undefined reference to glBlendEquation@4' C:\qt\5.9.2\Src\qtlocation\lib\libqmapboxgld.a(value.o): In function ZN4mbgl2gl5value10BlendColor3SetERKNS_5ColorE':
                        C:\qt\5.9.2\Src\qtlocation\src\3rdparty\mapbox-gl-native/src/mbgl/gl/value.cpp:212: undefined reference to glBlendColor@16' C:\qt\5.9.2\Src\qtlocation\lib\libqmapboxgld.a(value.o): In function ZN4mbgl2gl5value7Program3SetERKj':
                        C:\qt\5.9.2\Src\qtlocation\src\3rdparty\mapbox-gl-native/src/mbgl/gl/value.cpp:224: undefined reference to glUseProgram@4' C:\qt\5.9.2\Src\qtlocation\lib\libqmapboxgld.a(value.o): In function ZN4mbgl2gl5value13ActiveTexture3SetERKh':
                        C:\qt\5.9.2\Src\qtlocation\src\3rdparty\mapbox-gl-native/src/mbgl/gl/value.cpp:248: undefined reference to glActiveTexture@4' C:\qt\5.9.2\Src\qtlocation\lib\libqmapboxgld.a(value.o): In function ZN4mbgl2gl5value15BindFramebuffer3SetERKj':
                        C:\qt\5.9.2\Src\qtlocation\src\3rdparty\mapbox-gl-native/src/mbgl/gl/value.cpp:285: undefined reference to `glBindFramebuffer@8'

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          Allerknappe
                          wrote on last edited by
                          #15

                          so if i try qmake "INCLUDEPATH+=C:/mysql/MySQL/MySQLConnector.C6.1/include" "LIBS+=C:/mysql/MySQL/MySQLConnector.C6.1/lib/libmysql.lib" mysql.pro
                          i only get the error Project ERROR: Library 'mysql' is not defined.
                          in the stash file is insert:

                          QMAKE_CXX.INCDIRS =
                          C:/qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include
                          C:/qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include-fixed
                          C:/qt/Tools/mingw530_32/i686-w64-mingw32/include
                          C:/qt/Tools/mingw530_32/i686-w64-mingw32/include/c++
                          C:/qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32
                          C:/qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward
                          QMAKE_CXX.LIBDIRS =
                          C:/qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0
                          C:/qt/Tools/mingw530_32/lib/gcc
                          C:/qt/Tools/mingw530_32/i686-w64-mingw32/lib
                          C:/qt/Tools/mingw530_32/lib
                          QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
                          QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 5
                          QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3
                          QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
                          QMAKE_CXX.COMPILER_MACROS =
                          QT_COMPILER_STDCXX
                          QMAKE_GCC_MAJOR_VERSION
                          QMAKE_GCC_MINOR_VERSION
                          QMAKE_GCC_PATCH_VERSION

                          sometimes this hole errors are a little mysterious for me...

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            Allerknappe
                            wrote on last edited by
                            #16

                            ok i have a solution for my problem:

                            in an other forum i read that mysql and the description how to build the plugin only work till qt version 5.7 .
                            so i tried it with 5.7 and now it works! maybe there is a solution for higher versions, but for me it is enough

                            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