mssql-cli icon indicating copy to clipboard operation
mssql-cli copied to clipboard

Unable to connect to server on custom port

Open general-albatross opened this issue 7 years ago • 6 comments

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:

  1. setup sql server on port different than 1433
  2. 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;

general-albatross avatar Feb 10 '18 12:02 general-albatross

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.

chriswolf-nrg avatar Mar 22 '18 20:03 chriswolf-nrg

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.

LeeiFrankJaw avatar Jun 19 '18 07:06 LeeiFrankJaw

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

chriswolf-nrg avatar Jun 19 '18 14:06 chriswolf-nrg

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.

LeeiFrankJaw avatar Jun 19 '18 15:06 LeeiFrankJaw

I have the same issue with 0.15.0.

Blackbaud-JasonBodnar avatar Nov 16 '18 19:11 Blackbaud-JasonBodnar

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.)

mdavis-xyz avatar Jan 17 '22 03:01 mdavis-xyz