我正在尝试在我的 Mac 上设置一个新的开发环境
- 开发操作系统:MacOS 10.13.2
- 蟒蛇:3.6
- pyodbc:4.0.21
- 驱动管理器:unixODBC 2.3.4
- 驱动程序:FreeTDS 1.00.79
- DB:MS SQL Server 2017 Developer [Microsoft SQL Server 2017 14.0.3008.27 (X64) Developer Edition (64-bit) on Linux (Ubuntu 16.04.3 LTS)] 从https://docs.microsoft.com/en-us下载/sql/linux/quickstart-install-connect-docker#pull-and-run-the-container-image
问题
telnet
到mssql-linux2017
1433 上的 docker 镜像就可以了
sqlcmd
失败并出现以下错误
[ODBC][22520][1512841146.847871][SQLGetDiagFieldW.c][815]
Entry:
Connection = 0x7fcbe2010c00
Rec Number = 2
Diag Ident = 5
Diag Info Ptr = 0x7ffeec672b3c
Buffer Length = -6
String Len Ptr = 0x0
[ODBC][22520][1512841146.848022][SQLGetDiagFieldW.c][835]
Exit:[SQL_SUCCESS]
[ODBC][22520][1512841146.848195][SQLGetDiagFieldW.c][815]
Entry:
Connection = 0x7fcbe2010c00
Rec Number = 2
Diag Ident = 6
Diag Info Ptr = 0x7fcbe200d200
Buffer Length = 2050
String Len Ptr = 0x7ffeec672b40
[ODBC][22520][1512841146.848367][SQLGetDiagFieldW.c][835]
Exit:[SQL_SUCCESS]
[ODBC][22520][1512841146.848539][SQLGetDiagFieldW.c][815]
Entry:
Connection = 0x7fcbe2010c00
Rec Number = 2
Diag Ident = 4
Diag Info Ptr = 0x7ffeec672b44
Buffer Length = 12
String Len Ptr = 0x7ffeec672b40
[ODBC][22520][1512841146.848711][SQLGetDiagFieldW.c][835]
Exit:[SQL_SUCCESS]
[ODBC][22520][1512841146.848939][SQLGetConnectAttrW.c][211]Error: SQL_INVALID_HANDLE
理想情况下我想做
pyodbc.connect('DRIVER=ODBC Driver 13 for SQL Server;SERVER=localhost;PORT:1433;DATABASE=<SOMEDB>;UID=SA;PWD=<myPass>')