'Unable Connect to SQL Server 2019 using PYODBC

Using PYODBC I am trying to connect to SQL Server 2019 which is not installed locally.

But I am getting below error:

pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

My Connection String is:

MSSQL_conn_str = "DRIVER={ODBC Driver 18 for SQL Server};DATABASE=<>;UID=<>;PWD=<>;SERVER=<IP>;"

MS SQL Server Installed in Windows Server 2019. Below ODBC Driver are there: ODBC Driver 18 for SQL Server, ODBC Driver 17 for SQL Server, SQL Server, SQL Server Native Client 11.0.

Ports are open, telnet responds successfully.

I thought I should do it via DSN. So I tried. While creating DSN I am getting below error.

enter image description here

Any solution how to solve this ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source