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. QSqlDriver does not support Transactions (but everything seems to be installed)
QtWS25 Last Chance

QSqlDriver does not support Transactions (but everything seems to be installed)

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 3 Posters 4.1k Views
  • 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.
  • M Offline
    M Offline
    MrEinsA
    wrote on 20 Dec 2017, 09:57 last edited by
    #1

    Hello all,

    i create a connection to a local 10.1.26-MariaDB. Im using QSqlDatabase to connect to it ... everything works fine ... i can INSERT, UPDATE, SELECT .... . But if i ask with:

        QSqlDatabase db = QSqlDatabase::database();
        if (!db.driver()->hasFeature(QSqlDriver::Transactions))
    

    It returns false.

    My installation is following:

    • Windows 7 (64bit)
    • Qt5.7.0
    • MySQL Workbench 6.3 CE (i link there to the libmysql.dll)
    • db setup with xampp (because of this mariadb)

    I really dont get whats wrong ... searching now for 8 hours but find nothing.

    Thanks for you help guys,

    MrEinsA

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VRonin
      wrote on 20 Dec 2017, 10:08 last edited by
      #2

      Most likely is due to a restriction in the Qt code that manages the driver. what driver are you using? what are you passing to QSqlDatabase::addDatabase?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      M 1 Reply Last reply 20 Dec 2017, 10:13
      0
      • V VRonin
        20 Dec 2017, 10:08

        Most likely is due to a restriction in the Qt code that manages the driver. what driver are you using? what are you passing to QSqlDatabase::addDatabase?

        M Offline
        M Offline
        MrEinsA
        wrote on 20 Dec 2017, 10:13 last edited by
        #3

        @VRonin

        Thanks for the fast reply, this is my connection code:

            m_dbConnection = QSqlDatabase::addDatabase("QMYSQL");
            m_dbConnection.setHostName(host);
            m_dbConnection.setPort(port);
            if (!m_dbConnection.open(user, password))
            {
                coutFRed("::connect, %s", qPrintable(m_dbConnection.lastError().text()));
                return false;
            }
              coutFGreen("::connect, connection active...");
        
        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 20 Dec 2017, 21:43 last edited by
          #4

          Hi and welcome to devnet,

          What version of MySQL is your server ?

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

          M 1 Reply Last reply 2 Jan 2018, 07:35
          0
          • S SGaist
            20 Dec 2017, 21:43

            Hi and welcome to devnet,

            What version of MySQL is your server ?

            M Offline
            M Offline
            MrEinsA
            wrote on 2 Jan 2018, 07:35 last edited by
            #5

            @SGaist
            Happy new year!!!

            I run it with the current XAMPP on my localhost (10.1.26-MariaDB), but even with a database on my server MySQL 5.7.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 2 Jan 2018, 21:50 last edited by
              #6

              Same to you !

              Did you rebuild the Qt MySQL plugin ?

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

              M 1 Reply Last reply 3 Jan 2018, 07:00
              0
              • S SGaist
                2 Jan 2018, 21:50

                Same to you !

                Did you rebuild the Qt MySQL plugin ?

                M Offline
                M Offline
                MrEinsA
                wrote on 3 Jan 2018, 07:00 last edited by
                #7

                @SGaist
                Hm nope i use the standard one directly from Qt. Is this probably a problem?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 3 Jan 2018, 21:28 last edited by
                  #8

                  Not necessarily. The transaction detection is effective if the client library version used to build the plugin is greater than 3.23.34. Now the question is is, are you sure the server supports it ?

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

                  M 1 Reply Last reply 4 Jan 2018, 06:39
                  0
                  • S SGaist
                    3 Jan 2018, 21:28

                    Not necessarily. The transaction detection is effective if the client library version used to build the plugin is greater than 3.23.34. Now the question is is, are you sure the server supports it ?

                    M Offline
                    M Offline
                    MrEinsA
                    wrote on 4 Jan 2018, 06:39 last edited by
                    #9

                    @SGaist
                    Thanks for the answer ... yes im sure, i tested it in the MySQL Workbench and its running there. Hm maybe i should reinstall everything again.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      MrEinsA
                      wrote on 5 Jan 2018, 15:13 last edited by
                      #10

                      Hello all,

                      if i generate the transaction by myself with QSqlQuery ... it works ... but not with the functions provided by the QSqlDriver. Hmpf

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 5 Jan 2018, 18:35 last edited by
                        #11

                        How were you using it ?

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

                        M 1 Reply Last reply 8 Jan 2018, 06:59
                        0
                        • S SGaist
                          5 Jan 2018, 18:35

                          How were you using it ?

                          M Offline
                          M Offline
                          MrEinsA
                          wrote on 8 Jan 2018, 06:59 last edited by
                          #12

                          @SGaist
                          Hi, like this:

                             m_dbConnection.setHostName(host);
                              m_dbConnection.setPort(port);
                              if (!m_dbConnection.open(user, password))
                              {
                                  return false;
                              }
                          
                              if (!m_dbConnection.driver()->hasFeature(QSqlDriver::Transactions))
                              {
                                  ...
                              }
                          
                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on 8 Jan 2018, 22:23 last edited by
                            #13

                            So basically if you don't do the check and use it, it works as expected ?

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

                            M 1 Reply Last reply 9 Jan 2018, 06:22
                            0
                            • S SGaist
                              8 Jan 2018, 22:23

                              So basically if you don't do the check and use it, it works as expected ?

                              M Offline
                              M Offline
                              MrEinsA
                              wrote on 9 Jan 2018, 06:22 last edited by
                              #14

                              @SGaist
                              Nope ... i tested it a lot and it dont work.

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on 9 Jan 2018, 23:01 last edited by
                                #15

                                Sorry, I misunderstood you. So if you write the transaction in the SQL statement of the QSqlQuery it's working properly. Correct this time ?

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

                                M 1 Reply Last reply 10 Jan 2018, 13:38
                                0
                                • S SGaist
                                  9 Jan 2018, 23:01

                                  Sorry, I misunderstood you. So if you write the transaction in the SQL statement of the QSqlQuery it's working properly. Correct this time ?

                                  M Offline
                                  M Offline
                                  MrEinsA
                                  wrote on 10 Jan 2018, 13:38 last edited by
                                  #16

                                  @SGaist
                                  Yes if i write the transaction sql syntax in the QSqlQuery by myself ... it is working correctly.

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on 14 Jan 2018, 22:24 last edited by
                                    #17

                                    That's not the most easy but I'd re-build the MySQL plugin to see what the check does currently.

                                    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