microsoft / homebrew-mssql-release

Other
92 stars 31 forks source link

My mac cannot connect to SQL Server on Windows Server 2012 R2 with Microsoft ODBC Driver 17 for SQL Server. #72

Closed boyamahero closed 11 months ago

boyamahero commented 2 years ago

Client - macOS Big Sur

install Microsoft ODBC 17 on mac

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
HOMEBREW_NO_ENV_FILTERING=1 ACCEPT_EULA=Y brew install msodbcsql17 mssql-tools

Server - Windows Server 2012 R2 ,

Microsoft SQL Server Standard (64-bit), OS: Microsoft Windows NT 6.3 (9600) ,Platform: NT x64, verrsion: 12.0.6433.1

Error

sqlcmd -S 10.xx.xx.xxx -U sa -P "password" -Q "SELECT @@VERSION"
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.

but if Server - Windows Server 2016, it can connect SQL Server (Microsoft SQL Server Standard (64-bit), OS: Microsoft Windows NT 6.3 (14393) ,Platform: NT x64, verrsion: 12.0.6433.1)

sqlcmd -S 10.xx.xx.xx -U sa -P "password" -Q "SELECT @@VERSION"  
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQL Server 2014 (SP3-CU4-GDR) (KB4583462) - 12.0.6433.1 (X64) 
    Oct 31 2020 02:54:45 
    Copyright (c) Microsoft Corporation
    Standard Edition (64-bit) on Windows NT 6.3 <X64> (Build 14393: ) (Hypervisor)

(1 rows affected)

Please help.

v-chojas commented 2 years ago

0x2746 = 10054 - connection reset by peer

Is there a firewall between the client and server? Are there any events in the event log on the server side corresponding to the connection attempts?

boyamahero commented 2 years ago

Thanks @v-chojas , I found error log

Event ID: 36874- 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.

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.

v-chojas commented 2 years ago

Windows update KB2929781 adds new cipher suites which might include the ones your client is requesting - you could install that on the server, or if you cannot change the server, then you'll need to specify on the client in the openssl.cnf a cipher suite the server supports.

boyamahero commented 2 years ago

I couldn't find KB2929781 but found KB2919355. KB2919355 is already installed on server. but I cannot do specify on the client in the openssl.cnf a cipher suite.

v-chojas commented 2 years ago

Perhaps the cipher suites requested by the client have been disabled on the server? Check the SChannel registry settings and associated group policy entries, if any.

David-Engel commented 11 months ago

Closing as inactive.