更新:如果你遇到了同样的问题,可以通过这里讨论问题的根源。
使用 homebrew 升级到 Python3.10 后,我的 OpenSSL 版本也升级到了版本 3。
现在我无法连接到 SQL Server,因为 ODBC 需要 OpenSSL 1.1 或 1.0。所以当我运行以下命令时:
isql -v -k "<connection string"
我遇到了以下错误:
[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
但是当我查看 /usr/local/etc/
目录时,发现已经安装了 openssl@1.1
:
我该如何解决这个问题?我对此不是很熟悉。因此 ODBC 需要找到正确的 OpenSSL 版本,也就是 1.1。
我尝试过:
ln -s /usr/local/Cellar/openssl@1.1/1.1.1g /usr/local/opt/openssl
同时当我运行
openssl
命令时,它会找到正确的版本:➜ ~ openssl
OpenSSL> version
OpenSSL 1.1.1l 24 Aug 2021
OpenSSL>
输出 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)
➜ ~
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
同时运行 DYLD_PRINT_LIBRARIES=1 isql -v -k "<connection string"
命令可以给出以下输出。似乎它仍然链接到 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
brew list openssl@1.1
和ls -l /usr/local/opt/openssl/lib/libssl.dylib
命令的输出编辑您的问题。 - AlwaysLearning