The Microsoft SQL Server fails to connect with "CLI error trying to establish connection... Login failed..." when using Windows NTLM Authentication


The following error might occur when you run a LIBNAME to the Microsoft SQL Server and supply your Windows user ID as “domain\userd”:

CLI error trying to establish connection: [SAS][ODBC SQL Server Wire Protocol driver] Socket closed : [SAS][ODBC SQL Server Wire Protocol driver] 01006 : [SAS][ODBC SQL Server Wire Protocol driver] Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication.

This issue occurs after you upgrade to SAS® Viya® 2025.06. This issue will be fixed in a later SAS Viya version.

Workaround

To circumvent this issue, supply the domain name in the ODBC DSN option:

Domain=domainName

Then, remove the domain name from the USER= option in your LIBNAME statement.

Here is an example:

libname a sqlsvr dsn=xxxxx user=userid password=yyyyy;