Microsoft SQL Server Native Client 10.0 Login timeout expired

浪尽此生 提交于 2019-12-19 08:06:54

问题


I have a freshly installed SQL Server 2008 R2 Express. I'm trying to run SQLCMD locally (please do take note locally) but I am receiving the error:

Named Pipes Provider: Could not open a connection to SQL Server [2]
Sqlcmd: Error: Microsoft SQL Serve Native Client 10.0 : A network-related or instance-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 if SQL Server is configured to allow remote connections. For more informations see SQL Server Books Online..
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0: Login timeout expired.

Why can't I make it work? I already tried everything.


回答1:


Maybe a little late on the draw here but for future readers with the issue: Try running Command Prompt as Administrator.




回答2:


I ran into the same problem. I used -S, instead of -s, and removed the "" before and after the servername\instance. Everything ran great after that.




回答3:


In the named pipes properties just change the path to \\.\pipe\sql\query instead of default path




回答4:


I had this same thing happen to me for a client trying to setup a new SQL-Server box.

Open your SQL-Server configuration manager on the machine where SQL is actually INSTALLED.

Look to the SQL Native Client 10.0 Configuration. Under that is Client Protocols. You probably have TCP/IP and Named Pipes DISABLED. You need to ENABLE them.




回答5:


This seems to happen too when the server or the instance can't be found.

It will eventually close with the reason (the first part of the error may be what misguided you):

Sqlcmd: Error: ... : Login timeout expired.

Sqlcmd: Error: ... : A network-related or instance-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 if SQL Server is configured to allow remote connections.

So:

  • Check the server name is correct;
  • Check the instance name is correct (and if you didn't mean to use the default instance, try remove the instance name completely);
  • Check if the server can be reached using ping, etc.



回答6:


I had the same issue, the reason is because sqlcmd when typed alone without the servername, tries to connect to the default server. If you have named instance then it cannot connect to it without specifying the instance name. Work around is to make the named instance as default by changing the port as shown in this link: SQL Server, convert a named instance to default instance?



来源:https://stackoverflow.com/questions/14815297/microsoft-sql-server-native-client-10-0-login-timeout-expired

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!