5

I'm trying to connect to a SQL Server Express server from a Linux Ubuntu 16.04 computer. I Installed all SQL commad line utilities for the linux machine and follow instructions from Microsoft SQL Server on Linux docs.

When I run

sqlcmd -S ip/SQLEXPRESS -U SA -P 1234

the command always returns the following error :

Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Error code 0x2AF9

I was able to run the same command from a Windows 10 computers and it works with no flaws.

The linux computer can communicate to the server machine and SQL Server 1433 port. I test this with the linux nc command (netcat).

Linux nc command results:

nc -z -v -w5 192.168.0.1 1433

Connection to 192.168.0.1 1433 port [tcp/ms-sql-s] succeeded!

Any suggestions or something missing?

I have tried changing the ports, parameter order etc... and Linux version of sqlcmd doesn't work.

I also tried including extra '/' character, because it is special on Linux. The new command line is sqlcmd -S ip//SQLEXPRESS -U SA -P 1234 but it doesn't work. It works faster but returns other error:

Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Error code 0x2746.

Instance name doesn't work neither. sqlcmd -S SERVER-NAME\\SQLEXPRESS -U SA -P 1234 or sqlcmd -H ipaddress -S SERVER-NAME\\SQLEXPRESS -U SA -P 1234 The command recognizes quotes so sqlcmd -S "SERVER-NAME\SQLEXPRESS" -U SA -P 1234. Nothing works.

The correct syntax is sqlcmd -S ip\\SQLEXPRESS -U SA -P 1234 with double '\'. It doesn't connect anyway. I have several days struggling with it and could not find a way to make this thing work.

Paul White
95.3k30 gold badges439 silver badges689 bronze badges
asked Jul 11, 2017 at 19:46
1

1 Answer 1

1

I think the right command should be:

sqlcmd -S <IP>\\SQLEXPRESS,1433 -U SA 
answered Jun 20, 2020 at 20:48
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.