8

Update: if you have this same issue, the source of the problem is being discussed here


After upgrading to Python3.10 with homebrew, my OpenSSL was upgraded to version 3 as well.

Now I can't connect to my SQL Server anymore, since ODBC requires OpenSSL 1.1 or 1.0. So when I run:

isql -v -k "<connection string"

I get the following error:

[08001][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [OpenSSL library could not be loaded, make sure OpenSSL 1.0 or 1.1 is installed]
[08001][Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection

But when I look in /usr/local/etc/ I see that openssl@1.1 is installed:

openssl version

How can I solve this problem? Not really familiar with this. So ODBC needs to find the correct OpenSSL version, which is 1.1.

I tried:

ln -s /usr/local/Cellar/openssl@1.1/1.1.1g /usr/local/opt/openssl

Also when I run openssl command, it finds the correct version:

➜  ~ openssl
OpenSSL> version
OpenSSL 1.1.1l  24 Aug 2021
OpenSSL> 

Output brew list openssl@1.1

/usr/local/Cellar/openssl@1.1/1.1.1l_1/.bottle/etc/ (7 files)
/usr/local/Cellar/openssl@1.1/1.1.1l_1/bin/c_rehash
/usr/local/Cellar/openssl@1.1/1.1.1l_1/bin/openssl
/usr/local/Cellar/openssl@1.1/1.1.1l_1/include/openssl/ (104 files)
/usr/local/Cellar/openssl@1.1/1.1.1l_1/lib/libcrypto.1.1.dylib
/usr/local/Cellar/openssl@1.1/1.1.1l_1/lib/libssl.1.1.dylib
/usr/local/Cellar/openssl@1.1/1.1.1l_1/lib/engines-1.1/ (2 files)
/usr/local/Cellar/openssl@1.1/1.1.1l_1/lib/pkgconfig/ (3 files)
/usr/local/Cellar/openssl@1.1/1.1.1l_1/lib/ (4 other files)
/usr/local/Cellar/openssl@1.1/1.1.1l_1/share/doc/ (3971 files)
/usr/local/Cellar/openssl@1.1/1.1.1l_1/share/man/ (3971 files)
➜  ~ 

Output of ls -l /usr/local/opt/openssl/lib/libssl.dylib

lrwxr-xr-x  1 username  admin  14 Sep  7 13:46 /usr/local/opt/openssl/lib/libssl.dylib -> libssl.3.dylib

Also running DYLD_PRINT_LIBRARIES=1 isql -v -k "<connection string" gives me the following. Seems like it is still linked to openssl@3

dyld: loaded:  /usr/local/opt/openssl/lib/libssl.dylib
dyld: loaded: /usr/local/Cellar/openssl@3/3.0.0/lib/libcrypto.3.dylib
[08001][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [OpenSSL library could not be loaded, make sure OpenSSL 1.0 or 1.1 is installed]
[08001][Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection
[ISQL]ERROR: Could not SQLDriverConnect
Erfan
  • 40,971
  • 8
  • 66
  • 78

3 Answers3

15

After trying many things, I found a (hacky) solution:

  1. I removed the link in /usr/local/opt/:
rm openssl
  1. Created a new link to openssl@1.1
ln -s /usr/local/Cellar/openssl@1.1/1.1.1l_1 /usr/local/opt/openssl
Erfan
  • 40,971
  • 8
  • 66
  • 78
0

Have you tried reinstalling msodbcsql17?

Older versions of msodbcsql17 report a dependency on OpenSSL 1.1:

$ brew deps -n msodbcsql17
m4
libtool
unixodbc
openssl@1.1

Reinstalling msodbcsql17...

$ brew reinstall msodbcsql17
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.0.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:ec819e57038f4ae11e3a3e083ec1d37c174e44fce08830bd
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:ec819e57038f4ae11e3a3e083ec1d37c174
######################################################################## 100.0%
==> Downloading https://download.microsoft.com/download/1/9/A/19AF548A-6DD3-4B48-88DC-724E9ABCEB9A/msodbcsql17-17.8.1.1-
==> Reinstalling microsoft/mssql-release/msodbcsql17 
==> Installing dependencies for microsoft/mssql-release/msodbcsql17: openssl
==> Installing microsoft/mssql-release/msodbcsql17 dependency: openssl
==> Pouring openssl@3--3.0.0.catalina.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
  /usr/local/Cellar/openssl@3/3.0.0: 6,415 files, 28.2MB
==> Installing microsoft/mssql-release/msodbcsql17
The license terms for this product can be downloaded from
https://aka.ms/odbc17eula and found in
/usr/local/share/doc/msodbcsql17/LICENSE.txt . By entering 'YES',
you indicate that you accept the license terms.
Do you accept the license terms? (Enter YES or NO)
YES
==> odbcinst -u -d -n "ODBC Driver 17 for SQL Server"
==> odbcinst -i -d -f ./odbcinst.ini
  /usr/local/Cellar/msodbcsql17/17.8.1.1: 10 files, 2MB, built in 9 seconds

After reinstalling or upgrading msodbcsql17, OpenSSL 3 is now reported as a dependency:

$ brew deps -n msodbcsql17
m4
libtool
unixodbc
openssl@3
AlwaysLearning
  • 7,915
  • 5
  • 27
  • 35
0

I am not sure which link did you remove, since I have all of them in the link below

ls /usr/local/opt: -openssl -openssl@1.1 -openssl@3

Did you remove /usr/local/opt/openssl ? What should we do with /usr/local/opt/openssl@1.1 and /usr/local/opt/openssl@3? Should we keep them?

In addition I don't see 1.1.1l_1 within /usr/local/opt/openssl@1.1.

I tried this: ln -s /usr/local/Cellar/openssl@1.1/1.1.1l_1 /usr/local/opt/openssl This is response I am getting and the same problem is still there: ln: /usr/local/opt/openssl: File exists

Thanks

Diana
  • 1
  • 1
  • This is not an answer that helps the original question. If you have a similar problem please, be free to open a new question in order to get help there from the community. – Ali Briceño Oct 21 '21 at 03:00