jdbc.SQLServerException: Login failed for user for any user jdbc.SQLServerException: Login failed for user for any user sql sql

jdbc.SQLServerException: Login failed for user for any user

If you try to connect with database which is using windows authentication, you can use 'integratedSecurity' option in your connection string.


Having been through this very recently the steps I took to solve pretty much the same problem were

  1. use SQL Server Management Studio to log in with the desired account and confirm access to read (and write if necessary)
  2. Use SQL Server Configuration Manager to confirm that the server instance is listening on the IP address being targetted
  3. Disable the firewall to check that isn't getting in the way (and add an exception if necessary for future use)

The absolute kicker for me was understanding what IP addresses and ports the instance was set to listen on so that when I constructed the connection string the connection wasn't being rejected.

Also, if you want to connect using Windows logins you need to ensure the SQL instance is configured for mixed mode authentication (i.e. to allow Windows and SQL logins)

Since you get this error,the Sql server correctly listens to the port.

  1. Open Sql Server Management Studio connect to your Server.
  2. right click on the server's icon and choose properties.
  3. Go to the security tab and tick Sql Server and WindowsAuthentication mode.

If you want to define a user,go from the tree, to Security->Logins,right click on logins folder and click "New Login".

Now your server should work with this Url String.Use the log file of the Server that may help you understand its working.