I am getting an exception in Java while connecting to SQL. The error says
"Login failed for user abc "
But never in my code have I user
“abc ” (with whitespaces at end)
Username is “abc” only.
What is the reason behind the exception?
Thanks.
Do you hard-code it in your source or you get the string from somewhere? I have a feeling that this is a simple typo, otherwise, check for any method that may have appended a space character to the end of a string. You might have this string stored in a database/file that has this extra space.
For a quick and dirty solution, trim the String before you pass it for login.