0
votes

I can access SSIS server and DB from SSMS on local desktop, getting results from select * from sysjobs. In trying to access the SSIS server and DB from python 3.7 64-bit, using connection string Driver={SQL Server}; Server=BSWHPACTIANDBD1; Database=msdb; Trusted_Connection=True, I cannot connect to the database using pypyodbc or pyodbc;

failure is here: connection = X.connect(connect_string), where X = pyodbc|pypyodbc

pyodbc error is

pyodbc.OperationalError: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error (18) (SQLDriverConnect); [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (SECDoClientHandshake()). (772)')

pypyodbc error is

pypyodbc.DatabaseError: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error')

Windows 10, 64-bit

Any suggestions or ideas, please?

1

1 Answers

1
votes

I had this problem on my windows PC and solved it as below:

Downloaded & installed a new SQL Server driver (for me it was below page, maybe changes with time) https://docs.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver15

Then on your PC go to Administrative tools -> ODBC Data Source (64 or 32 bit) -> drivers

Then take the name of the driver you just installed and use it in your python connection

import pyodbc
try:
    conn = pyodbc.connect(
        driver='{ODBC Driver 17 for SQL Server}', # this is the name
        server='hostname.com',
        database='DB_NAME',
        uid='user_id',
        pwd='password')
    print(conn)
except Exception as e:
    print(e)