Connecting to MSSQL server using sqlcmd and odbc driver on RHEL 6 fails
After reading this thread: https://github.com/Microsoft/msphpsql/issues/190
I had to find out another portnumber SQL Server was listening on by executing
USE MASTER
GO
xp_readerrorlog 0, 1, N'Server is listening on'
GO
Result
2018-04-12 03:19:57.830 Server Server is listening on [ 'any' <ipv6> 49155].
2018-04-12 03:19:57.830 Server Server is listening on [ 'any' <ipv4> 49155].
add a Rule for the Windows Firewall on SQL Server host: - enabling specific Port 49155 (I think this can vary)
Then this command succeeded on my Ubuntu machine:
sqlcmd -Smyhost,49155 -U sa -P sa_pwd -d mydb -Q "select @@servername"