Cannot connect to MSSQL due to Login-based server access validation failed with an infrastructure error

I have an application (web application) written in Java and database on MS SQL. Both, Tomcat (with application) and database server are on my localhost.
I’m trying run an application but in Java logs I have:

org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Login failed for user ‘some-user’.)
Caused by: java.sql.SQLException: Login failed for user ‘some-user’.

In database logs error looks like:

Logon Error: 18456, Severity: 14, State: 12.
Logon Login failed for user ‘some-user’. Reason: Login-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: 127.0.0.1]

When I’m tying login to server via Microsoft SQL Server Managment Studio (choosing “SQL Server Authentication”) everything is OK.
But with the same credentials my Java application cannot login.

Additional informations:

My connection url is jdbc:jtds:sqlserver://127.0.0.1:1434/some-db

some-user has a public server role and two database roles membership for some-db (db_datawriter and public). Default schema for some-user is db_datawriter.

Additionally some-user has some-db as a default database.

Answer

Why are you connecting to port 1434? The default port is TCP 1433 for the database instance; UDP 1434 is used for the browser service, which I suspect is only supported by Microsoft client libraries (I could be wrong, though).

Leave a Reply

Your email address will not be published. Required fields are marked *