Python-无法连接到MS SQL [英] Python - Can't connect to MS SQL

查看:150
本文介绍了Python-无法连接到MS SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

推荐答案

对于我来说,它是通过激活 SQL Server(SQLEXPRESS)在服务中。事实证明,计算机启动时它不会自动打开。

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.

这篇关于Python-无法连接到MS SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆