I am trying to connect to a remote SQL Server with mssql-cli
, I use this command:
/usr/local/bin/mssql-cli -S server -U admin -d db -P ****
and I get this error:
Error message: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)
However, I am able to connect using sqsh with no problem:
sqsh -S server -U admin -D db -P ****
Since I can connect with sqsh but not mssql-cli
, and I am able to connect to a local instance of SQL Server, I'm not sure where to go from here.
I found the answer here: https://askubuntu.com/questions/1284658/how-to-fix-microsoft-odbc-driver-17-for-sql-server-ssl-provider-ssl-choose-cli
The answer is to update to the latest openssl:
I also installed mssql-tools and unixodbc-dev - although I don't know if that had anything to do with it:
https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-ver15
These docs are for 16.04; so you have to change that to 20.04 if you're using mint 20 or ubuntu 20.04 like I am:
It installs to /opt/mssql-tools/bin, so make sure add /opt/mssql-tools/bin/ to your PATH environment variable in a bash shell.