Coder Perfect

Error: Error code 0x2746 from TCP Provider. During the Sql installation in Linux through terminal

Problem

I’m attempting to install the MS-SQL server on my Linux system using the documentation found at https://docs.microsoft.com/pl-pl/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-2017.

The status of the SQL server is Active (Running).

During the execution of the command, I receive the following error:

sqlcmd -S localhost -U SA -P '<YourPassword>'

Error:

I also attempted it by issuing the command.

sqlcmd -S 127.0.0.1 -U SA -P '<YourPassword>' 

However, the same problem appears. It also displays the same problem when I try a different password.

Asked by Suba Nandhini K

Solution #1

[UPDATE 17.03.2020: Microsoft has published SQL Server 2019 CU3 with a repository for Ubuntu 18.04. See https://techcommunity.microsoft.com/t5/sql-server/sql-server-2019-now-available-on-ubuntu-18-04-support-on-sles/ba-p/1232210 for more information. I’m hoping that this is now totally compatible with no SSL issues. [I haven’t tried it yet, jet.]

Reverting to 14.0.3192.2-2 solves the problem.

However, the solution suggested by Ola774 may be used to remedy the problem not only while upgrading from Ubuntu 16.04 to 18.04, but on any installation of SQL Server 2017 on Ubuntu 18.04.

Microsoft appears to have screwed up their own patch for the ssl-version difficulties that was implemented in cu10 (https://techcommunity.microsoft.com/t5/SQL-Server/Installing-SQL-Server-2017-for-Linux-on-Ubuntu-18-04-LTS/ba-p/385983) in cu16. However, linking the ssl 1.0.0 libraries is successful.

So here’s what you should do:

This will override the original service configuration. When the override-file, or more precisely “drop-in-file,” is used for the first time, it is correct that it is empty.

Answered by MSSQL_Ubuntu

Solution #2

Revert to the previously default weaker key length if you’re encountering problems with the client on Debian 10 with OpenSSL1.1.1. To do so, follow these steps:

Modify the config file /etc/ssl/openssl.cnf as follows (fyi, read the list of known issues with OpenSSL 1.1.1 on Debian 10 below):

Change CipherString = DEFAULT@SECLEVEL=2 to CipherString = DEFAULT@SECLEVEL=1 on the last line.

https://github.com/microsoft/msphpsql/issues/1021
https://wiki.debian.org/ContinuousIntegration/TriagingTips/openssl-1.1.1

Answered by miktea

Solution #3

sudo apt-get install mssql-server=14.0.3192.2-2

For me, reverting to this version worked.

My case was a fresh install of Ubuntu Server 18.04.2 with everything up to date, and I was getting the following client connection issue from sqlcmd:

Microsoft ODBC Driver 17 for SQL Server: Sqlcmd: Error: Provider of TCP: 0x2746 is the error code.

Answered by Kurt Preston

Solution #4

There are still some concerns after upgrading from Ubuntu 16.04 to 18.04.

To connect to SQL Server, some systems may require version 1.0 of the OpenSSL library. It is possible to use OpenSSL 1.0 in the following way:

Stop SQL Server

sudo systemctl stop mssql-server

Start the service configuration editor.

sudo systemctl edit mssql-server

Add the following lines to the file in the editor and save it:

[Service]
Environment="LD_LIBRARY_PATH=/opt/mssql/lib"

For SQL Server to use, create symbolic links to OpenSSL 1.0.

sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.so

Start SQL Server

sudo systemctl start mssql-server

I hope this information is useful.

Answered by Ola774

Solution #5

Error code 0x2746 from TCP Provider

This is most likely due to a conflict between the openssl and sql-server protocols and versions.

Check the version of openssl you’re using. Open your terminal and type the following command: openssl version

$ openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017

If your openssl version is not 1.0, you may wish to try one of the following solutions to fix the connection problem:

sed -i -E 's/(CipherString\s*=\s*DEFAULT@SECLEVEL=)2/\11/' /etc/ssl/openssl.cnf

Yes, it is correct. cnf.

If you have SECLEVEL set to 1 in your /etc/ssl/openssl.cnf file, this command will set it to 1. Done.

If your version of openssl is 1.1, you’d probably prefer it to be 1.0. The procedure is straightforward: download the source code, configure it, then generate the binary. It can take a few minutes to put everything together:

cd /usr/local/src/
wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1k.tar.gz
tar -xvf /usr/local/src/openssl-1.0.1k.tar.gz
cd /usr/local/src/openssl-1.0.1k
./config --prefix=/usr/local/ --openssldir=/usr/local/openssl
make
make test
make install
mv /usr/bin/openssl /usr/bin/openssl-bak

then

cp -p /usr/local/openssl/bin/openssl /usr/bin/openssl

or

cp -p /usr/local/ssl/bin/openssl /usr/bin/openssl
ll -ld /usr/bin/openssl
openssl version

If you need help with something specific, such as a Docker image or a different system, please leave a comment.

Answered by ofundefined

Post is based on https://stackoverflow.com/questions/57265913/error-tcp-provider-error-code-0x2746-during-the-sql-setup-in-linux-through-te