Python - Can't connect to MS SQL

[亡魂溺海] 提交于 2020-01-05 04:51:49

问题


When I try to connect to MS SQL, I got this error:

> pyodbc.Error: ('08001', '[08001] [Microsoft][ODBC Driver 13 for SQL
> Server]SQL Server Network Interfaces: Error Locating Server/Instance
> Specified [xFFFFFFFF].  (-1) (SQLDriverConnect); [HYT00]
> [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired (0);
> [08001] [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.
> (-1)')

How can I resolve this error and finally connect to the database?


回答1:


In my case, it was solved by activating SQL Server (SQLEXPRESS) in services. It turns out, it doesn't turn on automatically when the computer starts.



来源:https://stackoverflow.com/questions/39573669/python-cant-connect-to-ms-sql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!