2009-05-05 206 views
0

我有一个连接到SQL Server 2005默认实例的脚本。但我和连接,而是有以下消息无法使用osql连接到SQL Server

[SQL Native Client]Named Pipes Provider: Could not open a connection to SQL Server [53]. 
[SQL Native Client]Login timeout expired 
[SQL Native Client]An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. 

脚本的内容是:

osql -E -S <servername> -i D:\scripts\script1.sql -o D:\scripts\script1.txt 

我看着从SQL Server配置管理器的网络连接。 TCP/IP已启用,但命名管道已禁用。

我的问题是什么可能是这个错误的可能原因和解决方案?

回答

0

尝试osql -E -S(本地)或osql -E -S。我还没有弄清楚为什么有时它可以工作,而其他时间则不行。