mkleehammer/pyodbc

sqlalchemy.exc.OperationalError: (pyodbc.OperationalError) ('08001', '[08001] [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:0A000102:SSL routines::unsupported protocol] (-1) (SQLDriverConnect)')

patlxg opened this issue · 1 comments

Please first make sure you have looked at:

Environment

To diagnose, we usually need to know the following, including version numbers. On Windows, be
sure to specify 32-bit Python or 64-bit:

  • Python: 3.10.2
  • pyodbc: 5.1.0
  • OS: Ubuntu
  • DB: SQL SERVER
  • driver: Driver 18

Issue

Often it is easiest to describe your issue as "expected behavior" and "observed behavior".

My solution was:
sudo apt-get update

Install libodbc.so, libtdsS.so, isql, and isqlinst:

sudo apt-get install unixodbc

Install FreeTDS ODBC driver:
sudo apt-get install freetds-dev freetds-bin tdsodbc

Check where the odbcinst files are located:
odbcinst -j

Verify the path, then proceed with the respective configuration:
ls /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so

Configure the odbcinst.ini file and paste the following at the top of the file.

NOTE: We use Ubuntu Server 22, each Linux distribution may have a different path.

[FreeTDS] Description = FreeTDS unixODBC Driver Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so

NOTE: Ensure that the driver used in the Python request is 0, the position where FreeTDS is registered.

NOTE: We run the UVICORN server with FASTAPI in Python.

FINAL NOTE: Execute the project and verify that the API works correctly. In case it continues to not work, we must change the OpenSSL version to the oldest version we use, OpenSSL 1.1.1v.