Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Username with backslash #62

Closed
lucastechbiosis opened this issue Sep 9, 2019 · 1 comment
Closed

Username with backslash #62

lucastechbiosis opened this issue Sep 9, 2019 · 1 comment

Comments

@lucastechbiosis
Copy link

lucastechbiosis commented Sep 9, 2019

I have the following configuration in build.gradle:

liquibase {
	activities {
		main {
			changeLogFile "$config.db.changeLogFile"
			url 'jdbc:sqlserver://servername:1433;databaseName=dbname'
			username "org\\username"
			password 'password'
		}
	}
}

But I am always getting refused due to a login error:

Unexpected error running Liquibase: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'org\username'. ClientConnectionId:4fb06e1f-c236-4e08-b8f9-7e2e4c688657 liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'org\username'. ClientConnectionId:4fb06e1f-c236-4e08-b8f9-7e2e4c688657

I have censored the database name, username and password, other than that, these are the exact configuration I have.

I am able to connect to this database in a database management program (Tableplus) and all works fine there:
Screen Shot 2019-09-09 at 12 07 44

My guess is that something might be going wrong in the Liquibase side due to the backslash in the username, because I tried with an user that does not have the backslash and it did work.

So I am guessing this could be a bug, or is there some other way to escape the backslash?

@lucastechbiosis
Copy link
Author

The problem was not related to the plugin, or even to liquibase. The problem was in trying to login to an MSSql database using domain credentials.

For any future users affected with this issue, I changed my connection string:

liquibase {
	activities {
		main {
			changeLogFile "$config.db.changeLogFile"
			url 'jdbc:jtds:sqlserver://servername:1433;databaseName=dbName;domain=org;useNTLMv2=true;'
			username "username"
			password 'password'
		}
	}
}

So the domain is no longer declared in the username, but in the url. Also the change to jdbc:jtds:sqlserver means that Liquibase is using the jtds driver to connect with the database, which seems to be supported just fine.

I also did a push to try to use Kerberos integrated security authentication, but in the end I went with the NTLM authentication, as above. Anyway if that is of interest to you, go and check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant