我想用以下odbc.ini连接到MSSQL数据库:
[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.0
Trace=yes
TraceFile=/db.log
User=[user]
Password=[password]
Server=[server]\[instance]
Database=[db_name]
UsageCount=5我可以从PyCharm连接到数据库,所以凭据应该没问题。所有的东西都安装在Debian8和unixODBC 2.3.1版本的vagrant中。错误消息如下:
[HYT00][unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired
[08001][unixODBC][Microsoft][ODBC Driver 13 for SQL Server]MAX_PROVS: Error Locating Server/Instance Specified [xFFFFFFFF].
[08001][unixODBC][Microsoft][ODBC Driver 13 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
[ISQL]ERROR: Could not SQLConnect我没有db.log文件,我不知道如何找出问题出在哪里。当我尝试从流浪汉ping服务器时,一切正常。
我也在windows和ubuntu 16.04上尝试了sqlcmd工具。在windows上一切正常,但在Ubuntu上发生了同样的错误。命令:
sqlcmd -S [server]\[instance] -U [user] -d [table_name] -P [password]您对如何跟踪或调试此问题有什么建议吗?
发布于 2017-07-19 03:46:08
我在DBA上找到了答案。因此,在Linux上不能使用命令:
sqlcmd -S [server]\[instance] -U [user] -d [table_name] -P [password]只是
sqlcmd -S [server],[port] -U [user] -d [table_name] -P [password]你需要找到这个端口。之后,Pyodbc也开始工作
https://stackoverflow.com/questions/45172181
复制相似问题