I am using Python 3.7 and for a few years I have had a Python script that connected to an SQL server with the below code:
con_string = 'DRIVER={SQL Server};SERVER='+ server +';DATABASE=' + database
cnxn = pyodbc.connect(con_string)
cursor = cnxn.cursor()
Recently when running the script I get the below error:
OperationalError: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SSL Security error (18) (SQLDriverConnect); [08001] [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpen (SECCreateCredentials()). (1)')
I am not quite sure how to interpret this and have tried looking for solutions but had trouble understanding much of it?
Thanks
Update 18 August 2020
With Gords help I have updated my drivers and built a new connection string based on the answer below:
Pyodbc error Data source name not found and no default driver specified paradox
con_string = 'DRIVER={ODBC Driver 17 for SQL Server};TrustServerCertificate=No;Network=DBMSSOCN;DATABASE='+database+';WSID=L13-CHRISTOPHER;APP={Microsoft® Windows® Operating System};Trusted_Connection=Yes;SERVER='+server+';'
But I am still getting the error
OperationalError: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SSL Security error (18) (SQLDriverConnect); [08001] [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpen (SECCreateCredentials()). (1)')
Thanks