如何从 Ubuntu 调试 MSSQL 驱动程序问题 [英] How to debug MSSQL driver issues from Ubuntu

查看:93
本文介绍了如何从 Ubuntu 调试 MSSQL 驱动程序问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与我见过的其他几个问题类似,除了从 Django 连接到 MSSQL 之外,我别无选择.

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.

我间歇性地(但大约 50% 的时间,其余时间工作正常)收到错误;

I'm intermittently (but around 50% of the time, the rest it works fine) getting the error;

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

django.db.utils.Error: ('[08S01] [Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x274c (10060) (SQLGetData)')

注意,我有时也会得到这个;

Note, I also get this one sometimes;

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

django.db.utils.Error: ('08S01', '[08S01] [Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x68 (104) (SQLGetData)')

我认为它与网络有关,我以前尝试过换出 pyodbc 版本,在 FreeTDS 和 Microsoft 驱动程序之间交换 unix,并尝试 pyodbcpyodbc-azure.

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.

有问题的机器是具有固定 IP 的专用网络上的 Vagrant 机器(Ubuntu 16.04 和 Windows 8),SQL Server 是 SQL Server Express 2016.

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.

我什至不知道如何在 Windows 端找到更详细的日志来弄清楚它为什么/如何不断断开/关闭连接.注意 - 我查看了 SQL Server 和 Windows 事件日志,但它们似乎没有发现任何问题.

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. Note - I've looked in the SQL Server and Windows event logs and they don't seem to be picking anything up.

推荐答案

以下是一些基于记录的错误代码的有用链接:

Here are some useful links based on the error codes logged:

10060

与服务器建立连接时发生错误.连接 SQL Server 时,此故障可能是由以下事实引起的在默认设置下 SQL Server 不允许远程连接.(提供者:TCP 提供者,错误:0 - 连接尝试失败,因为连接方在一段时间后没有正确响应一段时间,或建立连接失败,因为已连接主机未能响应.)(Microsoft SQL Server,错误: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. (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)

通常,您可以通过导航到 SQL Server 实例并确保允许远程连接来解决此问题.为此,SSMS 中有一个配置设置.您还需要确保将服务器设置为使用集成模式安全性.即 - windows/ad 凭据和 sql server 凭据.您可以定义未绑定到用户 Windows 身份的 SQL 服务器用户.

Generally, you can fix this by navigating to the SQL Server instance and making sure remote connections are allowed. There is a configuration setting in SSMS for this. You also want to make sure the server is set up to use integrated mode security. i.e - windows/ad credentials and sql server credentials. You can define a SQL server user not bound to a user windows identity.

这篇关于如何从 Ubuntu 调试 MSSQL 驱动程序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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