简体   繁体   English

Pyodbc 登录超时错误 (Azure) SQL 服务器

[英]Pyodbc login time out error with (Azure) SQL Server

I am getting a strange error with Python condo environments and PyODBC.我在 Python 公寓环境和 PyODBC 中遇到一个奇怪的错误。 I have multiple Conda environments, I am able to connect from one of the environment (from a Linux machine) to SQL Server hosted on Azure but not from the other one.我有多个 Conda 环境,我能够从其中一个环境(从 Linux 机器)连接到 SQL 服务器托管在 Azure 上,但不能从另一个环境连接。 Both Python environments have version 3.7.7 of Python and version 4.0.0 of Pyodbc. Python 环境都有 Python 的 3.7.7 版本和 Pyodbc 的 4.0.0 版本。 Code is exactly the same and connection string uses SQL Server 17 driver.代码完全相同,连接字符串使用 SQL Server 17 驱动程序。

conn_str='DRIVER={ODBC Driver 17 for SQL Server};SERVER=' +server+';Authentication=ActiveDirectoryPassword;DATABASE='+database+';UID='+self.user_name+';PWD='+self.password

Error is:错误是:

pyodbc.OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)') pyodbc.OperationalError: ('HYT00', '[HYT00] [Microsoft][SQL 服务器的 ODBC 驱动程序 17] 登录超时已过期 (0) (SQLDriverConnect)')

  • As you can see above, the issue might be DNS-related.如您所见,问题可能与 DNS 相关。 In the connection string, try using an IP address instead of the hostname, or check your DNS setup.在连接字符串中,尝试使用 IP 地址代替主机名,或检查您的 DNS 设置。

  • Try downgrade to ODBC driver 13 and have a try.尝试降级到 ODBC 驱动程序 13 并试一试。 For that version 17 needs to be uninstalled.对于该版本,需要卸载 17。

  • Try using connect from SQL Authentication instead of Active Directory Password.尝试使用来自 SQL 身份验证的连接,而不是 Active Directory 密码。

The SQL Server ODBC drivers for Linux from Microsoft are unable to determine instance names. Microsoft 的 SQL 服务器 ODBC 驱动程序 Linux 无法确定实例名称。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python pyodbc 写入 Microsoft Azure SQL 数据库错误 - Python pyodbc write to Microsoft Azure SQL Database Error 使用“ActiveDirectoryPassword”身份验证和 pyodbc 连接到无服务器 Azure Synapse SQL 池时收到“登录超时已过期” - Receiving `Login timeout expired` when connecting to a serverless Azure Synapse SQL pool using `ActiveDirectoryPassword` authentication and pyodbc 连接到 Azure 时出现 SQL 登录失败错误 (18456) SQL - Getting SQL login failed error (18456) when connecting to Azure SQL 创建用于将 MS Access 链接到 Azure SQL 服务器的登录过程 - Creating login procedure for Linking MS Access to Azure SQL server Azure SQL 数据库 - 随机错误:用户 '***' 登录失败 - Azure SQL Database - randomly error: Login failed for user '***' 如何在 Azure SQL 服务器使用 Azure ARM 模板中一次添加多个客户端 IP 地址? - How to add multiple client IP addresses at time in Azure SQL Server using Azure ARM Templates? 无法使用 PyODBC 和 AWS Lambda 连接 RDS SQL 服务器 - Unable to connect with RDS SQL Server using PyODBC & AWS Lambda Azure SQL 数据库的瞬态登录错误 - Transient Login errors for Azure SQL Database 部署SQL Server数据库到Azure SQL数据库报错 - Error occurs when I deploy SQL Server database to Azure SQL database 由于连接超时,无法运行 mlDeploy 以删除 Azure 上的 ML 服务器 - Fail to run mlDeploy to Remove ML server on Azure due to connect time out
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM