안녕하세요, 닷넷으로 개발중인 입문자 입니다.
현재 C# .NET 8.0 Avalonia UI 를 이용하여
Windows 와 Linux (Ubuntu 22.04 / 24.04) 쪽에서 둘다 실행이 가능한
프로그램을 만드려 하는데,
MS SQL Server와의 연결을 위하여 Microsoft.Data.SqlClient 의
SqlConnection 을 이용하여 Open()을 하려 했습니다.
접속하려고 테스트한 SQL Server는 총 3개 입니다.
- Microsoft SQL Server 2005 - 9.0.3077
- Microsoft SQL Server 2008 R2 (SP2) - 10.50.4042.0 (X64)
- Microsoft SQL Server 2022 - 16.0.1000
처음에는
"
Error: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 31 - Encryption(ssl/tls/ handshake failed)
" 오류가 발생하였는데, 자료를 찾던 중
위 링크의 내용을 참고하면서 테스트를 진행해봤습니다.
2번과 3번의 경우에는 답변의 내용대로 openssl.cnf 를 수정하니
Connection O.K 가 되었는데,
1번 Server의 경우에는 오류 내용이
"
Error: Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=0; handshake=9; [Login] initialization=0; authentication=0; [Post-Login] complete=14005;
"
로 바뀌었으나 실제로 연결이 되지는 않습니다.
이것저것 찾아보다 보니,
Linux (ubuntu)의 경우 SSL 의 TLS 정책을 따라가는데
Microsoft.Data.SqlClient를 Linux 에서 사용하려면
최소 TLS v1.2 가 필요한데
MS SQL Server 2005와 패치가 안 된 2008의 경우에는
TLS v1.0 만 지원하므로 사용할 수 없다라고 하네요.
이 경우에, 만약
MS SQL Server 2005 와 Microsoft.Data.SqlClient 간에
연결이 가능한 다른 방법이 있을까요?
아니면 구형 서버는
System.Data.SqlClient 를 이용하는 방법밖에 없을까요?