views:

12557

answers:

6

I've just installed SQL Server 2008 Developer edition and I'm trying to connect using SQLCMD.exe, but I get the following error:

H:\>sqlcmd.exe -S ".\SQL2008"

Msg 18452, Level 14, State 1, Server DEVBOX\SQL2008, Line 1

Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

Has anyone seen this before? Any idea what it means??

+2  A: 

You're not passing any credentials to sqlcmd.exe

So it's trying to authenticate you using the Windows Login credentials, but you mustn't have your SQL Server setup to accept those credentials...

When you were installing it, you would have had to supply a Server Admin password (for the sa account)

Try...

sqlcmd.exe -U sa -P YOUR_PASSWORD -S ".\SQL2008"

for reference, theres more details here...

Eoin Campbell
The SQL Server instance is configured to use SQL Server and Windows Authentication mode.If I specify -U sa then I can log in successfully, but I'd like to use windows authentication. Connecting using SSMS with windows authentication seems to work fine..
Tom
A: 

Do you specify a user name and password to log on? What exactly is your complete command line?

If you're running on your own box, you can either specify a username/password, or use the -E parameter to log on with your Windows credentials (if those are permitted in your SQL server installation).

Marc

marc_s
The complete command line is as posted in the question, nothing else. -E doesn't seem to make any difference, the same error is thrown.
Tom
Is your current user that you're running under on your DEVBOX been added to the SQL Server as a "login" ?
marc_s
Yep, the Windows AD account has been added as server login with all server roles.
Tom
A: 

Your error is quite literally saying "you're trying to use Windows Authentication, but your login isn't from a trusted domain". Which is odd, because you're connecting to the local machine.

Perhaps you're logged into Windows using a local account rather than a domain account? Ensure that you're logging in with a domain account that is also a SQL Server principal on your SQL2008 instance.

Aaron Alton
I am logged into windows using a domain account that is also a server principal on the 2008 instance.
Tom
+1  A: 

Just tried this:

H:>"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe" -S ".\SQL2008" 1>

and it works.. (I have the Microsoft SQL Server\100\Tools\Binn directory in my path).

Still not sure why the SQL Server 2008 version of SQLCMD doesn't work though..

Tom
A: 

I had this issue and it was because the machine running the application isnt trusted for delegation on the domain by active directory. If it is a .net app running under an application pool identity DOMAIN_application.environment for example.. the identity can't make calls out to SQL unless the machine is trusted.

Steve
A: 

I traced this down to a difference between a Windows XP Home and XP Professional server. (Created two almost-identical Virtual PC servers with SQL 2008 Express)

When I connect to the XP Home system it connects using the SERVER\Guest account successfully.

When I try to connect to the XP Pro system, it fails with the 18452 error (Guest user is enabled and working).

The SQL Server (2008 Express) logins both have the SERVER\Guest account enabled?

Why does XP Pro produce this error?

Joe