Sqlcmd:错误:Microsoft SQL Server Native Client 10.0:通信链接失败 [英] Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Communication link failure

查看:28
本文介绍了Sqlcmd:错误:Microsoft SQL Server Native Client 10.0:通信链接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面,您会注意到我试图从 Microsoft SQL Server 2008 的 64 位 Program Files 文件夹调用的一些 Windows 命令提示符命令

C:\Program Files\Microsoft SQL Server\100\Tools\Binn>SQLCMD -S "SQLI2B2" -d"I2B2_CRC-DEV" -i "C:\SVN\ONT\SQL SERVER\DX_SQLSERVER.sql" -E

<块引用>

HResult 0x2746,级别 16,状态 1 TCP 提供程序:现有连接被远程主机强行关闭.

Sqlcmd:错误:Microsoft SQL Server Native Client 10.0:通信链接失败.

c:\Program Files\Microsoft SQL Server\100\Tools\Binn>

现在,我连接的数据库(服务器)是 SQL Server 2008.我在Microsoft SQL Server"文件夹下有几个目录.90、100、110 和 120.只有 100 和 110 具有 .\Tools\Binn\SQLCMD.EXE 文件.我在 \\Control Panel\All Control Panel Items\Administrative Tools\Data Sources (ODBC)\Drivers\ 中注意到以下驱动程序,所以我不知道客户端驱动程序是否适合我的服务器版本.

名称 版本SQL Server 6.01.7601.17514SQL Server 本机客户端 10.0 2009.100.1600.01SQL Server 本机客户端 11.0 2011.110.3000.00

命令中的 -E 暗示使用 Windows 身份验证,而不是 SQL Server 身份验证(使用实际用户和密码).

可能导致此错误的原因是什么,如何解决?

注意事项:

这是在 Windows 7 上发现的.以下分辨率仅适用于较早的操作系统.

https://msdn.microsoft.com/en-us/library/ms187005.aspx

解决方案

第一个错误:

<块引用>

TCP Provider:一个现有的连接被远程强行关闭主持人.

通信链接失败

较小的文件将运行,但如果文件太大,您仍会收到此异常.我能找到的唯一解决方案是将包含 T-SQL 命令的文件分成多个较小的文件.

第二个错误:

<块引用>

Sqlcmd:错误:Microsoft SQL Server Native Client 10.0:通信链接失败.

在Binn"文件夹中,除了可执行文件本身之外,SQLCMD.EXE 还需要运行其他文件.附加到现有的系统PATH"环境变量或在 \\Control Panel\All Control Panel Items\System\Advanced system settings\Environment Variables\ 中添加新的用户PATH"环境变量.

变量名:PATH变量值:C:\Program Files\Microsoft SQL Server\100\Tools\Binn\

Below, you'll notice some Windows Command Prompt commands that I'm trying to call from the 64 bit Program Files folder for Microsoft SQL Server 2008

C:\Program Files\Microsoft SQL Server\100\Tools\Binn>SQLCMD -S "SQLI2B2" -d
 "I2B2_CRC-DEV" -i "C:\SVN\ONT\SQL SERVER\DX_SQLSERVER.sql" -E

HResult 0x2746, Level 16, State 1 TCP Provider: An existing connection was forcibly closed by the remote host.

Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Communication link failure.

c:\Program Files\Microsoft SQL Server\100\Tools\Binn>

Now, the database (server) I'm connecting to is SQL Server 2008. I had several directories under the "Microsoft SQL Server" folder. 90, 100, 110, and 120. Only 100 and 110 had the .\Tools\Binn\SQLCMD.EXE file. I noticed the following drivers in \\Control Panel\All Control Panel Items\Administrative Tools\Data Sources (ODBC)\Drivers\, so I don't know if the client driver is correct for my server version.

Name                            Version
SQL Server                      6.01.7601.17514
SQL Server Native Client 10.0   2009.100.1600.01
SQL Server Native Client 11.0   2011.110.3000.00

The -E in the command implies to use Windows Authentication, instead of SQL Server Authentication (with an actual user and password).

What could be causing this error, and what can fix it?

Notes:

This was found on Windows 7. The following resolution only applies to earlier Operating Systems.

https://msdn.microsoft.com/en-us/library/ms187005.aspx

解决方案

First error:

TCP Provider: An existing connection was forcibly closed by the remote host.

Communication link failure

Smaller files will run, but if the file is too big, you'll still receive this exception. The only solution I could find was to break the file containing the T-SQL commands into multiple smaller files.

Second error:

Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Communication link failure.

There must be other files in the "Binn" folder that SQLCMD.EXE needs to run besides the executable file itself. Either append to the existing SYSTEM "PATH" environment variable or add a new USER "PATH" environment variable in \\Control Panel\All Control Panel Items\System\Advanced system settings\Environment Variables\.

Variable name: PATH
Variable value: C:\Program Files\Microsoft SQL Server\100\Tools\Binn\

这篇关于Sqlcmd:错误:Microsoft SQL Server Native Client 10.0:通信链接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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