Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Cannot open database

Author  Topic 

Ambikaa
Starting Member

43 Posts

Posted - 2008-08-11 : 06:14:25
Hi,

I am getting this error in sqlserver 2005
Cannot open database "RealEstate" requested by the login. The login failed. Login failed for user 'MORTGAGE\IWPC_1(mydomains)'.
My connection string
<add key="connectionstring" value="SERVER=.\SQLEXPRESS;DATABASE=RealEstate;UID=Admin;PASSWORD=sa;Trusted_Connection=Yes"/>

help me

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-08-11 : 07:24:09
Open management studio, connect to that server and see if the database "RealEstate is there and is online.

And I seriously hope those aren't your real username and passwords. If so, change them, immediately.
Also, specifying Trusted_Connection=Yes means that you want windows authentication, and hence don't need to specify a username and password.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-08-11 : 23:20:17
And ensure there is sql login 'admin' in the server with permission to access that db.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-08-12 : 03:11:39
Looks like the windows authentication is taking precedence over the specified username and password. (Login failed for user 'MORTGAGE\IWPC_1)

Check that the login "MORTGAGE\IWPC_1" exists and has access to the DB. If you want the user to be admin, remove the "Trusted_Connection=Yes" from your connection string.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -