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. What database and why?
Forum Updated to NodeBB v4.3 + New Features

What database and why?

Scheduled Pinned Locked Moved General and Desktop
11 Posts 4 Posters 3.7k 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
    SimonHaines
    wrote on last edited by
    #2

    Could it be that you haven't given the correct server name for the database server you're using?

    Try changing this line:

    @db.setHostName("localhost");@

    to use the IP address of your database server. Also I'm pretty sure MySQL requires the root account to have a password.

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

      It is really very simple. Your code is not at fault (at least, it is not the main issue). The error message is quite clear: your Qt MySql driver plugin is not loaded. Did you actually build it? It is not build by default when you install the SDK...

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

        [quote author="Andre" date="1298273948"]It is really very simple. Your code is not at fault (at least, it is not the main issue). The error message is quite clear: your Qt MySql driver plugin is not loaded. Did you actually build it? It is not build by default when you install the SDK... [/quote]

        Hi Andre, i've tryed to read a bit some places about this, and yes I do know about the missing driver thats why I posted the compile output :].

        what I'm wondering is it possible to connect to mysql without having to recompile example by using

        QODBC Drivers.

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

          You might be able to use ODBC, but if possible, you'll want to avoid that and use the direct driver instead. ODBC is not known for its speed...

          The MySQL driver by default only comes in sourcecode format, so you'll have to build it yourself. Depending on the platform you're on, that is really not so hard. You don't need to recompile all of Qt, just compile the driver.

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

            [quote author="Andre" date="1298371048"]You might be able to use ODBC, but if possible, you'll want to avoid that and use the direct driver instead. ODBC is not known for its speed... The MySQL driver by default only comes in sourcecode format, so you'll have to build it yourself. Depending on the platform you're on, that is really not so hard. You don't need to recompile all of Qt, just compile the driver.[/quote]

            if you have time could you please provide my the link where it explain step by step how to compile the drivers for mysql under windows and linux. ( I heard that linux you can use a sudo apt-get under unbuntu for the drivers already compiled ).

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

              Perhaps "this":http://christopher.rasch-olsen.no/2009/04/14/qt-45-and-mysql-plugin-with-mingw-on-windows-xp/ will give you a head start? I have found other guides (Google is your friend!), but they are basically the same idea. Note however that you do NOT need to rebuild all of Qt, as the guide linked above suggests. Simply issue the mingw32-make command in the driver directory instead.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dsylebee
                wrote on last edited by
                #8

                I know this is a ol post but I used this to be able to use MySQL on windows if it can help anyone.

                http://ieatbinary.com/2011/07/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/

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

                  These kinds of guides are always welcome here. Thanks for posting!

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    issam
                    wrote on last edited by
                    #10

                    Hi dsylebee. If you understand french, see this simple tutorial :
                    http://www.siteduzero.com/tutoriel-3-267200-maitrisez-les-bases-de-donnees-avec-qtsql.html

                    good luck !

                    http://www.iissam.com/

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      dsylebee
                      wrote on last edited by
                      #11

                      I do understand French though the topic is not about knowing how to use queries it's how to compile the drivers of MySQL for QT, but thanks anyways.

                      [quote author="issam" date="1341397726"]Hi dsylebee. If you understand french, see this simple tutorial :
                      http://www.siteduzero.com/tutoriel-3-267200-maitrisez-les-bases-de-donnees-avec-qtsql.html

                      good luck ![/quote]

                      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