2009-05-05 135 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。我還沒有弄清楚爲什麼有時它可以工作,而其他時間則不行。