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. Unable to connect to MSSQL due to certificate too weak

Unable to connect to MSSQL due to certificate too weak

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.4k 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.
  • M Offline
    M Offline
    Mark81
    wrote on last edited by Mark81
    #1

    I'm trying to connect to an MSSQL database with this code:

    QSqlDatabase _db;
    
    bool OdbcSql::connectToDB(QUrl host, QString database, QString username, QString password)
    {
        _db.setDatabaseName(QStringLiteral("Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1; Server=%1;Database=%2").arg(host.url()).arg(database));
        _db.setUserName(username);
        _db.setPassword(password);
        _db.setConnectOptions("SQL_ATTR_CONNECTION_TIMEOUT=5;SQL_ATTR_LOGIN_TIMEOUT=5");
    
        bool ret = _db.open();
        if (!ret) _db.lastError();
        return ret;
    }
    

    I get this error:

    QSqlError("", "QODBC: Unable to connect", "[Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:0A000086:SSL routines::certificate verify failed:EE certificate key too weak] [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection")
    

    I'm using Qt 6.2.0 under Ubuntu 22.04
    Any idea of what does "EE certificate key too weak" mean? I did a google search but I don't understand of which certificate is talking about and if it is on my machine or on the remote one.

    How to fix it?

    VRoninV 1 Reply Last reply
    0
    • M Mark81

      I'm trying to connect to an MSSQL database with this code:

      QSqlDatabase _db;
      
      bool OdbcSql::connectToDB(QUrl host, QString database, QString username, QString password)
      {
          _db.setDatabaseName(QStringLiteral("Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1; Server=%1;Database=%2").arg(host.url()).arg(database));
          _db.setUserName(username);
          _db.setPassword(password);
          _db.setConnectOptions("SQL_ATTR_CONNECTION_TIMEOUT=5;SQL_ATTR_LOGIN_TIMEOUT=5");
      
          bool ret = _db.open();
          if (!ret) _db.lastError();
          return ret;
      }
      

      I get this error:

      QSqlError("", "QODBC: Unable to connect", "[Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:0A000086:SSL routines::certificate verify failed:EE certificate key too weak] [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection")
      

      I'm using Qt 6.2.0 under Ubuntu 22.04
      Any idea of what does "EE certificate key too weak" mean? I did a google search but I don't understand of which certificate is talking about and if it is on my machine or on the remote one.

      How to fix it?

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      @Mark81 said in Unable to connect to MSSQL due to certificate too weak:

      I don't understand of which certificate is talking about

      Nothing to do with Qt. The certificate here is the SSL certificate of the server, it's not secure enough to establish a secure connection. Either witch to non-SSL, unencrypted connection or update your server

      "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

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved