SQL Server pyodbc certificate verify failed

2lpgd968  于 2023-08-02  发布在  其他
关注(0)|答案(1)|浏览(112)

I need to connect with pyodbc to a mssql server and receive following error:
('08001', '[08001] [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:0A000086:SSL routines::certificate verify failed:EE certificate key too weak] (-1) (SQLDriverConnect)')

My connection string is as following:

try:
        conn_str = f'DRIVER={{ODBC Driver 18 for SQL Server}};SERVER={self._server};DATABASE={self._database};UID={self._username};PWD={self._password}'
        conn = pyodbc.connect(conn_str)

        cursor = conn.cursor()
        return cursor
    except pyodbc.Error as err:
        print('pyodbc error')
        print(str(err))

How to avoid the check of the ssl certificate?

相关问题