简体   繁体   中英

[ODBC SQL Server Driver][DBNETLIB]SSL Security error (18)

I'm trying to connect to a SQL Server using pyodbc 4.0.30 with Python 3.7. Everything was going great the past couple of days until today when I get this error:

OperationalError: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error (18) (SQLDriverConnect); [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (SECCreateCredentials()). (1)')`

My connection:

conn = pyodbc.connect('driver={SQL Server};server=redacted;database=uipcc_awdb;uid=redacted;pwd=redacted;trusted_connection=no;')

Please note I can connect normally to the database via SQL Server Management Studio, and no changes were made on my machine, the SQL Server, or the network.

I need to emphasize, I have tried to following which were mentioned in similar questions (but none worked):

  • adding sslverify=0 in the connection parameters
  • adding encrypt=0 in the connection parameters
  • Changing the OBDC drivers from my machine, didn't work and ruined the connection from SQL Server Management Studio

This is most likely a TLS version issue. TLS 1.0/ TLS 1.1 has probably been disabled on the SQL Server.

There is currently an open issue on the pyodbc github tracker

And see this other question: Pyodbc giving exception with older version of sql driver but failing with latest version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM