Login failed for user with exception: java.sql.SQLInvalidAuthorizationSpecException


The Windows Authentication with i-net Merlia, the MS SQL JDBC driver, is failing with jdk1.8.0_181 or newer with the error message:

java.sql.SQLInvalidAuthorizationSpecException: [SERVER]Login failed for user ''.

This is a result of a security fix in the JDK: https://bugzilla.redhat.com/show_bug.cgi?id=1665953

To solve this you need to set the system property jdk.http.ntlm.transparentAuth. For example jdk.http.ntlm.transparentAuth=trustedHost or jdk.http.ntlm.transparentAuth=allHosts

See also: https://stackoverflow.com/questions/54568189/how-to-provide-ntlm-authentication-while-calling-any-url

You can do it via command line switch:


or via API before any authentication (HTTP, JDBC) occur:

System.setProperty( "jdk.http.ntlm.transparentAuth", "trustedHost" );

© Copyright 1996 - 2018, i-net software; All Rights Reserved.