简体   繁体   English

如何从 Ubuntu 调试 MSSQL 驱动程序问题

[英]How to debug MSSQL driver issues from Ubuntu

Similar to another couple of questions I've seen, I'm in the dark place of having no choice other than to connect to MSSQL from Django.与我见过的其他几个问题类似,除了从 Django 连接到 MSSQL 之外,我别无选择。

I'm intermittently (but around 50% of the time, the rest it works fine) getting the error;我间歇性地(但大约 50% 的时间,其余的工作正常)收到错误;

django.db.utils.Error: ('[08S01] [Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x274c (10060) (SQLGetData)') django.db.utils.Error: ('[08S01] [Microsoft][ODBC Driver 13 for SQL Server]TCP 提供程序:错误代码 0x274c (10060) (SQLGetData)')

Note, I also get this one sometimes;注意,我有时也会得到这个;

django.db.utils.Error: ('08S01', '[08S01] [Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x68 (104) (SQLGetData)') django.db.utils.Error: ('08S01', '[08S01] [Microsoft][ODBC Driver 13 for SQL Server]TCP 提供程序:错误代码 0x68 (104) (SQLGetData)')

I think it's network related, I've previously tried swapping out pyodbc versions, swapping between FreeTDS and Microsoft driver for unix, and trying pyodbc and pyodbc-azure .我认为它与网络有关,我以前尝试过换出pyodbc版本,在FreeTDS和 Microsoft 驱动程序之间交换 unix,并尝试pyodbcpyodbc-azure

The machines in question are Vagrant boxes on a private network with fixed IPs (Ubuntu 16.04 and Windows 8), SQL Server is SQL Server Express 2016.有问题的机器是具有固定 IP 的专用网络上的 Vagrant 机器(Ubuntu 16.04 和 Windows 8),SQL Server 是 SQL Server Express 2016。

I can't even work out how to find a more detailed log on the Windows side to work out why/how it keeps dropping/closing the connection.我什至不知道如何在 Windows 端找到更详细的日志来找出它为什么/如何不断断开/关闭连接。 Note - I've looked in the SQL Server and Windows event logs and they don't seem to be picking anything up.注意 - 我查看了 SQL Server 和 Windows 事件日志,他们似乎没有发现任何问题。

Here are some useful links based on the error codes logged:以下是一些基于记录的错误代码的有用链接:

10060 10060

An error has occurred while establishing a connection to the server.与服务器建立连接时发生错误。 When connecting to SQL Server, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.连接到 SQL Server 时,此失败可能是由于 SQL Server 在默认设置下不允许远程连接造成的。 (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (Microsoft SQL Server, Error: 10060) (提供者:TCP 提供者,错误:0 - 连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接的主机未能响应而建立的连接失败。)(Microsoft SQL Server,错误:10060)

Generally, you can fix this by navigating to the SQL Server instance and making sure remote connections are allowed.通常,您可以通过导航到 SQL Server 实例并确保允许远程连接来解决此问题。 There is a configuration setting in SSMS for this.为此,SSMS 中有一个配置设置。 You also want to make sure the server is set up to use integrated mode security.您还需要确保将服务器设置为使用集成模式安全性。 ie - windows/ad credentials and sql server credentials.即 - windows/ad 凭据和 sql server 凭据。 You can define a SQL server user not bound to a user windows identity.您可以定义不绑定到用户 windows 身份的 SQL 服务器用户。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM