开发者

SQL Server Login Using OSQL.exe

From Visual Studio 2010 I can connect to my SQL Server Express 2005 instance - by specifying windows authentication. However, when I use a command like it doesn't work:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>osql -S SQLEXPRESS -U Quixote
nt -P Password.0
[SQL Native Client]Named Pipes Provider: Could not open a connection to SQL
Server [53].
[SQL Native Client]Login tim开发者_Go百科eout 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.

Incidentally, the above does not actually list my windows name and password - I just substituted examples. What am I doing wrong?


You cannot use -U and -P if you want to connect with windows authentication. That is for SQL authentication. Use -E instead:

osql -S SQLEXPRESS -E


SQL Server 2005 provides several network protocols (like Shared Memory, TCP/IP, named pipes, etc.) (http://msdn.microsoft.com/en-us/library/ms187892(v=sql.90).aspx)

Maybe you only have Shared Memory enabled (which your VS is using), and the command line needs a named pipe or TCP/IP to connect.

So, try enabling the other protocols, through the SQL Server Configuration Manager, as described here:

http://support.microsoft.com/kb/914277/en-us

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜