I have spent several days on google search to find a solution, but no right one. so I post it here.
I have 3 VM machines.
VM 1:
windows server 2012 R2 sp1, 192.168.1.10
sql server 2016, port 1432
sql server 2017, port 1433
VM 2:
ubuntu 20.04
openssl 1.1.1p
VM 3:
ubuntu 22.04
openssl 3.0.2
on VM2 (ubuntu 20.04):
connect to sql server 2016
sqlcmd -S 192.168.1.10,1432 -U test -P test
successfully connect
connect to sql server 2017
sqlcmd -S 192.168.1.10,1433 -U test -P test
successfully connect
on VM3 (ubuntu 22.04):
connect to sql server 2017
sqlcmd -S 192.168.1.10,1433 -U test -P test
successfully connect
connect to sql server 2016
sqlcmd -S 192.168.1.10,1432 -U test -P test
get error:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Client unable to establish connection.
then I check sql server 2016’s log on VM1, find 2 errors:
Event ID: 36888
A fatal alert was generated and sent to the remote endpoint. This may result in termination of the connection. The TLS protocol defined fatal error code is 40. The Windows SChannel error state is 1205.
Event ID: 36874
An TLS 1.2 connection request was received from a remote client application, but none of the cipher suites supported by the client application are supported by the server. The SSL connection request has failed.
What I have tried:
1, modify /etc/ssl/openssl.cnf
MinProtocol = TLSv1.0
CipherString = DEFAULT@SECLEVEL=1
2, downgrade openssl to 1.1.1p
3, modify win server reg
HKLM SYSTEMCurrentControlSetControlSecurityProvidersSCHANNELProtocolsTLS 1.2
key: Enabled Value:1
4, execute windows update
I have tried all suggestions that I can find about "TCP Provider: Error code 0x2746." but none works for my case.
This issue happens when we sqlcmd to ms sql server 2016 in ubuntu 22.04 and openssl 3.0.2
any idea?
any suggestion?
any solution?
2
Answers
I setup an Ubuntu 20.04 machine a few months ago with the Microsoft ODBC Driver 17 for SQL Server and all the changes you mentioned above.
It worked great with sqlcmd.
A week ago, I tried setting up as above on Ubuntu 22.04 and hit the problem as above. So I setup a new Ubuntu 20.04 machine and I also could not get it to work as per your error above.
I tried the version 18 driver to no avail.
I finally got it to work by copying in libmsodbcsql-17.8.so.1.1 from the old Ubuntu 20.04 server to /opt/microsoft/msodbcsql17/lib64/ on the new Ubuntu 20.04 server and specifying it in /etc/odbcinst.ini instead of libmsodbcsql-17.10.so.1.1
I don’t know if that’s a production safe solution, but it certainly indicates where the problem lies. I haven’t tried it on Ubuntu 22.04 either.
I also have same problem like this. After looked for solution, finally I found this explanation
https://github.com/microsoft/msphpsql/issues/1419#issuecomment-1303626500
I keep use OpenSSL 3.0.2 and just need to change the
SECLEVEL
to0
instead of1
in/etc/ssl/openssl.conf
And it works, now I can connect to SQL Server using Ubuntu 22.04.