mssql-cli
mssql-cli copied to clipboard
Unable to connect to server on custom port
Hi,
I`m having problems with connecting to SQL Server On Linux using mssql-cli using Ubuntu 16.04. This is not related to firewall etc, as connection from same machine using mssql tool works fine.
Steps to reproduce:
- setup sql server on port different than 1433
- try to connect using following command:
mssql-cli -S HOST,PORT
Expected result: Successful connection
Actual result:
Connection did not succeed. Error message: Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=111; handshake=363; [Login] initialization=4; authentication=8; [Post-Login] complete=14033;
This works for me:
$ mssql-cli -S "tcp:someserver.domain.net,1435" -U someuser
You should make sure to prefix with tcp: and have the whole protocol:host,port in quotes.
I have the same problem.
mssql-cli -S 'server,port -d 'dbname' -U 'username' -P 'password'
The above command gives the following error message.
Error message: Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=34; handshake=154; [Login] initialization=3; authentication=6; [Post-Login] complete=14018;
The standard sqlcmd can connect to server without any problem.
sqlcmd -S 'server,port -d 'dbname' -U 'username' -P 'password'
I also tried what @chriswolf-nrg suggests by adding a protocol prefix
tcp, but to no avail, it doesn't work.
mssql-cli -S 'tcp:server,port -d 'dbname' -U 'username' -P 'password'
The above command gives the same error message as that of first command.
The version that works for me is 0.13.0. I should also mention that my environment is WSL (Windows Subsystem for Linux) with Ubuntu 16.04.2. https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux
My mssql-cli version is also 0.13.0, but I ran it under a true Linux environment (Ubuntu 16.04.4 LTS). The standard command sqlcmd works but mssql-cli doesn't. This really indicates a problem with mssql-cli.
I have the same issue with 0.15.0.
It works for me with that comma separation (even without double quotes).
The issue I had is that a comma separator is not intuitive. I first assumed there was some other flag (-P? Nope, that's password), then I tried host:port.
I think this needs to be documented. PR #522 does that. (But it hasn't been merged, and I don't know why.)