June 27, 2008 at 2:05 pm
Trying to use osql directly on my sql server (SQL2005).
If I use:
osql -U userid -P password -S server
This fails... says "Login failed for user "
If I use:
osql -E userid -S server
This works ok.
The -E is for Windows Authentication right?
I'm a little confused why I am not able to login using the -U command. I try using the domain name with the userid and it still does not work either.
Any ideas?
Thanks in advance,
Roger
June 27, 2008 at 2:13 pm
The username value you are putting in after the -E is being ignored and you are logging in as a windows user. Connect using -E BLAHBLAHBLAH and run SELECT SYSTEM_USER and you'll see what I mean.
Good Luck!
Chad
June 27, 2008 at 2:19 pm
Oh - I forgot to answer your other question. Check to see if mixed mode logins are enabled on the instance, and if so, confirm that the username/password combination are indeed correct. If neither of those work, run a profiler trace to see if the failed login is actually reaching the server and see if TCP/IP is enabled.
Good Luck!
Chad
June 29, 2008 at 6:27 pm
I think you can only use SQL Logins with the -U and -P Switch.
In order to mask your PAssword you can specify OSQL -U username then press enter and in the Password enter the password, which will not be visible.
NOTE: Try using SQLCMD, instead of OSQL (will be removed in future versions)
Maninder
www.dbanation.com
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply