Connecting to SQL Express via SQLCMD errors

  • Hi all,

    I cant connect to a sql express instance via sqlcmd and was hoping for some ideas!

    Command line:

    sqlcmd -S ./Offline -U sa -P 123abc456

    So far:

    SQL Browser is enabled

    TCP/IP is enabled

    Remote connections is enabled

    firewall is turned off.

    I can connect from the SQLCMD from the server with SQL Express on to another instance.

    I can connect from SSMS on a client machine to the SQL Express instance

    Im getting the following error:

    Error: Microsoft SQL Server Native Client 11.0 : Named pipes Provider: Could not open a connection to SQL Server

    Error: Microsoft SQL Server Native Client 11.0 : Login timeout expired.

    Error: Microsoft SQL Server Native Client 11.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 information see BOL.

    Hope someone can help!

  • Try sqlcmd -S .\Offline -U sa -P 123abc456

    in windows environment, mostly you use backslash \ not slash /

  • Well you are a genius...

    very simple.. and rather annoying on my part....

    thank you!

  • I am having the same problem. I've installed SQL Server 2012 on a Windows 8 machine. SQL Browser is enabled. Remote connections are enabled. Firewall has rules for SQL Server ports etc.

    My SQL Server is called DELL-D830\SQLEXPRESS

    My Server is on 192.168.200.149.

    If I do sqlcmd on the machine local to the SQL Server, no problem, everything works fine.

    If I do sqlcmd from a remote machine using command

    sqlcmd -S DELL-D830\SQLEXPRESS -U andy -P andy

    or

    sqlcmd -S 192.168.200.149\SQLEXPRESS -U andy -P andy

    Have also tried

    sqlcmd -H 192.168.200.149 -S .\SQLEXPRESS -U andy -P andy

    With all commands I try I get the same error messages as reported at the start of this thread.

    Any ideas what I've missed or are there any known problems with MSSS on Windows 8?

    cheers

    Andy

  • @Andy.gardner

    When you say "remote connections are enabled" are you referring to the TCP/IP protocol in Configuration Manager? If not, check it - it is disabled by default for SQL Express.

    Have you also checked that you can ping and telnet from the remote machine?

    P.S.

    Just noticed you have added your question to an old thread - For future reference you will often get a quicker response if you start a new one.

  • Thanks Richard. Yes I have enabled TCP/IP for remote connections. And I can ping the hosting machine from the remote machine.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply