I get this error when trying to connect to SQL Server.
Error is:
Login failed for user ''. The user is not associated with a trusted SQL Server connection.
Server resides remotely. From my localhost I am trying to connect using this URL:
"jdbc:sqlserver://serverName:portNo;integratedSecurity=true;databaseName=myDB"
But when I use the msSQL studio tool to connect to sql server doing windows authentication, it connects me without any error.
What is the difference in two cases?
Any help is appreciated.
Thanks
This can happen if you have an extra space in your connection string. It looks like you’ve modified your example above to hide the server name — make sure that your actual connection string doesn’t contain any spaces. See http://blogs.msdn.com/b/sql_protocols/archive/2005/09/28/474698.aspx
It can also happen if your web application is running under a different user — ie different to the one you’re using to run SQL Server Management Studio. See http://blogs.msdn.com/b/sql_protocols/archive/2008/05/03/understanding-the-error-message-login-failed-for-user-the-user-is-not-associated-with-a-trusted-sql-server-connection.aspx