com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'user2'.

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,
Expert tip

If you're not using yet, consider using the SQLServerDataSource to set your server configurations. Also, check if the server is accepting TCP/IP connections and if there's no firewall blocking the connections.

Solutions on the web

via Coderanch by jim shirreffs, 1 year ago
Login failed for user 'user2'.
via portugal-a-programar.pt by Unknown author, 2 years ago
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
via Google Groups by Gurumurthy, 5 months ago
Login failed for user 'Gurumurthy-PC\Gurumurthy'. The user is not associated with a trusted SQL Server connection.
via bigresource.com by Unknown author, 1 year ago
Cannot open database "MyHits" requested by the login. The login failed.
via bigresource.com by Unknown author, 1 year ago
Cannot open database "MyHits" requested by the login. The login failed.
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'user2'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)

Users with the same issue

Once, 8 months ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 2 years ago
Samebug visitor profile picture
Unknown user
2 times, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.