Monday, February 20, 2012

Login problem

I'm trying to connect to sql server 2005 & i'm getting the following error message

"Cannot open database 'XXXX' requested by the login. The login failed. Login failed for user Domain\User"

Ok i tried enabling disabling client protocols , i tried all Surface area configuration settings

I'm running Vista Ultimate With 2 processes & 4 cores

previously i was using xp and it worked untill i dettached & attached

So somewhere between Vista, 4 Cores & Attach Dettach the problem lies

I also tried changing sql server manegment studio security logons & users but that didn't help

Did you check if that user still exists in a domain of the network?|||

check the defult datbase of this particular user. Each user has a default database defined. check which is the default database for this user. it the database does not exists , change the default database of the user to any existing database

Madhu

|||

I suspect that you are using Vista’s UAC (User Account Control) feature. Under this feature, the Windows security token you are using to connect to SQL Server is not really a privileged user, and most likely you are getting access as a regular Windows user (I also assume you installed SQL Server Express in Vista).

Try running the following statement to confirm if my assumption is correct:

SELECT name, usage, type FROM sys.login_token ORDER BY usage, type, name

If you are running as a UAC token, you will see at least one row like the following:

BUILTIN\AdministratorsDENY ONLYWINDOWS GROUP

You should also notice that you are not a member of sysadmin.

For more detailed information on running SQL Server on Windows Vista, please visit BOL (http://msdn2.microsoft.com/en-us/library/Aa905868.aspx)

Quick workaround: Connect using SA login, and explicitly add yourself (or/and any other Windows user or groups you need) to sysadmin server role.

I hope this information helps.

-Raul Garcia

SDE/T

SQL Server Engine

|||

OK thanks to all for trying to help but none of the suggestions were helpfull

as it turns out i changed the name of the database in sql server management studio and then changed it back to the original and it just worked

since i had the excact same symptom on the computer where i was deploying to i tried it and it worked

I think it's very strange for this behaviour to be occuring some of the reasons i think they were occuring is because the attached database

was in the project or the bin\debug folder, also attaching and detaching the database creates problems for the user app to login

|||

I see. Most likely this is the default database for the login, and as it was not available, the connection was terminated early.

As a workaround in the future, you can explicitly specify a DB to connect to override the default DB. I would recommend connecting to master (master should always exist) and fix the default DB problem from there.

Thanks a lot for letting us know what was the root cause of the problem.

-Raul Garcia

SDE/T

SQL Server Engine

|||

Nothing strange in this.. if the default database is not there , you will not be able to login which was already mentioned in the previous post

Madhu

No comments:

Post a Comment