Python - 无法连接到MS SQL

时间:2016-09-19 12:51:10

标签: python sql-server database database-connection pyodbc

当我尝试连接到MS SQL时,出现了此错误:

> 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)')

如何解决此错误并最终连接到数据库?

1 个答案:

答案 0 :(得分:2)

就我而言,它是通过激活服务中的SQL Server (SQLEXPRESS)来解决的。事实证明,当计算机启动时它不会自动打开。

enter image description here