Cannot open database requested by the login. The login failed. Login failed for user
Posted
by
Cipher
on Stack Overflow
See other posts from Stack Overflow
or by Cipher
Published on 2011-01-15T09:44:52Z
Indexed on
2011/01/15
9:53 UTC
Read the original article
Hit count: 192
ASP.NET
|sql-server
Hi,
I have copied a DB from one my computers and using it here. On trying to open the page which requires the fetching content from DB, on con.open I am getting this exception:
Unable to open the physical file "E:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\cakephp.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". Unable to open the physical file "E:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\cakephp_log.LDF". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". Cannot open database "cakephp" requested by the login. The login failed. Login failed for user 'Sarin-PC\Sarin'.
I have attached the database from Management Studio Express 2008 and I have also checcked the connection string. Here it is:
<connectionStrings>
<add name="cn" connectionString="server=.\sqlexpress;database=cakephp;integrated security=true;uid=sarin;pwd=******"/>
</connectionStrings>
In Visual Studio, when I test the connection, it says "Test connection succeeded". However, there is one strange thing going on. When I login to the Management Studio, there is no + sign with the newly attached database, as shown.
If the full WebConfig is reqiured to be seen, I have pasted it here: http://pastebin.com/sVAuN0Ug
© Stack Overflow or respective owner