Unable to use Integratedsecurity with Liquibase for connecting MSSQL to specific database

Hi,

While using Liquibase for connecting MSSQL for specific database using integratedsecurity, I am getting error as shown below.

“Unexpected error running Liquibase: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database “Test” requested by the login. The login failed. ClientConnectionId:499723ca-6d22-4f54-b91d-cbf323caab81”

Parameters used are:

liquibase.integration.commandline.Main
–driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
–username=domain\testuser
–password=****
–url=jdbc:sqlserver://testsqlserver:1433;database=Test;integratedSecurity=true;

When we verify in MSSQL logs, we could see user id thats used for login as “NT AUTHORITY/SYSTEM”
Logs:
2020-12-08 12:58:33.25 Logon Error: 18456, Severity: 14, State: 38.
2020-12-08 12:58:33.25 Logon Login failed for user ‘NT AUTHORITY\SYSTEM’. Reason: Failed to open the explicitly specified database ‘Test’. [CLIENT: XXXXX]

Could you please let me know how to resolve this issue.

Hi @nagasatish,

I am not an expert at configuring Integrated Security on MSSQL but, I do have some experience with issues configuring liquibase. I noticed that in the logs you provided it says:

Why is it looking for:

Could you post the exact command line you are running?
Have you tried using: domain/testuser instead of domain\testuser (I wonder if it is seen as an escape char)?

Hi @ronak ,
I tried with escape characters and gave direct names as well, all options didnt work. It always tries to connect with ‘NT AUTHORITY\SYSTEM’. Not sure whats the problem here.

Please find the command line thats invoked here.

liquibase.integration.commandline.Main
–driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
–username=domian\test
–password=****
–url=jdbc:sqlserver://ServerName:1433;integratedSecurity=true;databaseName=DBTest;
–changeLogFile=db-changelog.xml
–contexts=2020.M11.2
–logLevel=info

Is Domain really ‘domian’?

no, i cannt give the actual domain name , so for easy understanding i gave that name here.

Can you connect to the database with the same AD account using another tool? I found this article which might be helpful if that is the case.

1 Like