dbcli / mssql-cli

A command-line client for SQL Server with auto-completion and syntax highlighting
BSD 3-Clause "New" or "Revised" License
1.35k stars 191 forks source link

Unable to connect to server #248

Open chrysophylax opened 5 years ago

chrysophylax commented 5 years ago

Hi,

I am unable to connect to a SQL Server 2016 running on the standard port 1433 on a Windows Server, but succeed in connecting with sqlcmd.

I have installed mssql-cli v0.15 using Direct Download and the RHEL default pkg manager yum.

The command being run is

mssql-cli -S server.hostname.tld -U actual_username -P $MSSQL_CLI I have also run the same but with manual password prompting (i.e. without the -P flag).

The error presented is Error message: One or more errors occurred. (Unable to write data to the transport connection: Connection reset by peer.)

With sqlcmd, I am running the following string and I get a command prompt on the server $ sqlcmd -S server.hostname.tld -U actual_username -P $MSSQL_CLI This allows me to execute SQL statements.

1>

chrysophylax commented 5 years ago

Talking with our technician for the SQL Server, he saw multiple connection errors that with the Profiler activated showed that sqlcmd correctly logins but mssql-cli (here shown as "Microsoft SQL Server Management Studio") does not work. image

chrishuan9 commented 5 years ago

@chrysophylax I encountered the same error on my first login attempt. In my case a second connection attempt was successful. Did you try to immediately connect again?

~$ mssql-cli -S xxxxx.database.windows.net -U Username -d DBname
Password:
Error message: One or more errors occurred. (Unable to write data to the transport connection: Connection reset by peer.)
~$ mssql-cli -S xxxxx.database.windows.net -U Username -d DBname
Password:
Version: 0.15.0
Mail: sqlcli@microsoft.com
Home: http://github.com/dbcli/mssql-cli
DBname> 
chrysophylax commented 5 years ago

Yes @cvarta we tried quite a few times.