2016-09-19 74 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

謝謝!這更直觀 –