2016-09-19 120 views
1

当我尝试连接到MS SQL,我得到这个错误:Python的 - 无法连接到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

在我的情况下,它通过激活SQL Server (SQLEXPRESS)服务解决。事实证明,电脑启动时它不会自动打开。

enter image description here

+2

只是FYI。您可以在SQL Server配置管理器http://i.stack.imgur.com/NV6FM.png :)中找到所有SQL Server实例/服务的(简单)概述。 – DenStudent

+0

谢谢!这更直观 –