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. start with the QtSQL module
Forum Updated to NodeBB v4.3 + New Features

start with the QtSQL module

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 6 Posters 2.6k Views 2 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.
  • 1 Offline
    1 Offline
    123456789
    wrote on last edited by
    #8

    @SGaist comigo não resultou

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #9

      @123456789 said in start with the QtSQL module:

      comigo não resultou

      How is it related to the question at hand ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • SGaistS SGaist

        Do you have MySQL installed on your machine ?

        E Offline
        E Offline
        EL-jos
        wrote on last edited by
        #10

        @SGaist since I'm also a webmaster so I use phpMyAdmin for the MYSQL database.

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

          @SGaist not result
          yes
          not result your solution

          1 Reply Last reply
          0
          • KillerSmathK Offline
            KillerSmathK Offline
            KillerSmath
            wrote on last edited by KillerSmath
            #12

            @123456789
            Get access of all sql modules using QT += sql in .pro file of your project.

            You can create a database object to create a connection with your database using QsqlDatabase Class

            http://doc.qt.io/qt-5/sql-connecting.html

            With a created database object, you can use QSqlQuery to insert, update, remove or recover information of your database

            http://doc.qt.io/qt-5/sql-sqlstatements.html

            @Computer Science Student - Brazil
            Web Developer and Researcher
            “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

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

              not result

              1 Reply Last reply
              0
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #14

                Hi
                Can you try this demo project.
                It runs for me and if yours still fail, something is wrong with your Qt install.
                https://www.dropbox.com/s/uo43f7sbiwcjazv/mySqlite.zip?dl=0

                output:

                create table: true

                "Young"
                "Holand"
                "Gordon"
                "Robitaille"
                "Papadopoulos"

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  EL-jos
                  wrote on last edited by
                  #15

                  Hi, here's my source code:

                  QSqlDatabase m_database = QSqlDatabase::addDatabase("QMYSQL");
                  m_database.setDatabaseName("127.0.0.1");
                   m_database.setPort(3306);
                  m_database.setUserName("root");
                  foreach(QString pilote, m_database.drivers())
                      qDebug()<< "Pilote: " << pilote;
                  if(m_database.open())
                      qDebug() << "Connexion réussie.";
                  

                  and here's the result:
                  QSqlDatabase: QMYSQL driver not loaded

                  QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

                  Pilote: "QSQLITE"

                  Pilote: "QMYSQL"

                  Pilote: "QMYSQL3"

                  Pilote: "QODBC"

                  Pilote: "QODBC3"

                  Pilote: "QPSQL"

                  Pilote: "QPSQL7"

                  1 Reply Last reply
                  1
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #16

                    I guess you are hitting the usual problem: do you have the MySQL client libraries that are accessible by your application ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • E Offline
                      E Offline
                      EL-jos
                      wrote on last edited by
                      #17

                      I don't know what a MySQL client library is and how to get it and what its importance?
                      if it is necessary to make simple I know nothing in module QtSQL
                      so if you can really help me use the QtSQL module, if there are things to download, you can tell me by posting the download link.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #18

                        The MySQL issue already triggered numerous threads on this forum, you should search for them.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        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