SqlCmd : Login timeout expired from localhost

Posted by mschr on Server Fault See other posts from Server Fault or by mschr
Published on 2012-11-11T12:53:38Z Indexed on 2012/11/12 5:02 UTC
Read the original article Hit count: 556

Filed under:
|
|

I've setup the instance SQLEXPRESS via SQL Server 2008 R2 installation, added a security login with all server roles, one called 'sqluser'.

The server authentication is SQL Server and Windows Authentication mode. However, when i specify the -S property, login fails.

There is no firewall enabled and SQL server even accepts connections from remote hosts.

C:\Users\user>sqlcmd -U sqluser -P qwerty -Q "Select * FROM testdb.dbo.testtable"

Output:

integer
-------
      1
      2
      3
      4

(4 rows affected)

However when specifying 'localhost' the query fails... Question is Why?

C:\Users\user>sqlcmd -S localhost/sqlexpress -U cpt -P 1234 -Q "Select * FROM cpt.dbo.testme"

Output:

HResult 0x43, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [67].
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or in    stance-specific error .....
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.

Changing 'localhost' with '%COMPUTERNAME' is same result if someone would be wondering. The server is running as a LocalSystem instance.

© Server Fault or respective owner

Related posts about sql-server

Related posts about tsql