试图运行 sqlcmd 失败,无法建立连接? [英] trying to run sqlcmd fails, unable to establish connection?

查看:27
本文介绍了试图运行 sqlcmd 失败,无法建立连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行 sqlcmd(从 cmd 提示符)时,出现以下错误:

When I try to run sqlcmd (from the cmd prompt) I get the following error:

HResult 0x2,级别 16,状态 1命名管道提供程序:无法打开与 SQL Server [2] 的连接.Sqlcmd: 错误: Microsoft SQL Server Native Client 10.0 : A network-related or in与 SQL Server 建立连接时发生特定于立场的错误.服务器未找到或无法访问.检查实例名称是否正确,我f SQL Server 配置为允许远程连接.有关更多信息,请参阅SQL Server 联机丛书Sqlcmd:错误:Microsoft SQL Server Native Client 10.0:登录超时.

HResult 0x2, Level 16, State 1 Named Pipes Provider: Could not open a connection to SQL Server [2]. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or in stance-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 i f SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.

不知道为什么会这样?我可以从我的 asp.net 网站(在本地运行,如数据库)连接到 sql 服务器,但 sqlcmd 无法连接.

Not sure why this happens? I can connect to the sql server from within my asp.net website (which runs locally, like the database) but sqlcmd can't connect.

推荐答案

Try sqlcmd -S

  • 只有在您将服务器安装为默认实例时,您的命令才会起作用.
  • 运行 sp_helpserver 以了解实例名称.

这篇关于试图运行 sqlcmd 失败,无法建立连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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