我的操作系统是 Windows 10
我的机器上安装了 SQL Server
我正在尝试从 Ubuntu bash 访问 SQL Server
这是我的代码
import pyodbc
ConnectionString = "DRIVER={ODBC Driver 17 for SQL Server};SERVER=DELLG3;DATABASE=R3;UID=sa;PWD=******;"
conn = pyodbc.connect(ConnectionString)
我收到此错误
asmgx@DELLG3:~$ python3 /mnt/c/py/28autosk.py
Traceback (most recent call last):
File "/mnt/c/py/28autosk.py", line 58, in <module>
conn = pyodbc.connect(ConnectionString)
pyodbc.OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')
我尝试了所有这些链接来帮助我解决问题,并且一直在使用谷歌搜索并尝试解决问题
https://www.microsoft.com/en-us/sql-server/developer-get-started/python/ubuntu/?rtc=1
https://askubuntu.com/questions/1147280/how-to-install-mssql-server-in-ubuntu-19-04
https://askubuntu.com/questions/462094/unable-to-install-libssl1-0-0i386-due-to-unmet-dependencies
谁能帮我从 Ubuntu 连接到 SQL Server?