Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47784

QSqlDatabase::open always returns true with QMYSQL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.5.1
    • Fix Version/s: 5.5.1
    • Component/s: SQL Support
    • Labels:
      None
    • Environment:
      OS X 10.8
    • Commits:
      0de6c52bfe2433eca768a5f6fe9d5f08a545c254

      Description

      While using the QMYSQL plugin, open always returns true even if the server is unreachable (e.g. not running)

      QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
      db.setHostName("unreachable");
      db.setPort(3306);
      db.setDatabaseName("test");
      db.setUserName("username");
      db.setPassword("password");
      if (!db.open()) {
          qDebug() << "Failed to open database" << db.lastError().databaseText();
      } else {
          qDebug() << "Success";
      }
      

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              sgaist Samuel Gaist
              Reporter:
              sgaist Samuel Gaist
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes