May 26, 2016 at 11:35 am
I downloaded an example application from Microsoft demonstrating something I'm trying to learn. I opened up the App.Config file and found that it uses a .MDF file that comes with the download and SQL Express to work with it. I didn't have SQL Express on my machine, so I went ahead and downloaded it and installed it earlier this morning. I downloaded and installed SQL Server 2014 Express, 64-bit version.
Next I got into Visual Studio and started to run it. It failed with a
Cannot open database "SchoolDB" requested by the login. The login failed.
error message.
So then I got into SSMS and connected to the SQLExpress database engine now on my machine. I saw that the database wasn't there (no real surprise here, I should have thought of that before trying to run the app in VS). However, my attempt to try to attach to the .MDF file also failed with the following error:
Operating system error 5: "5(Access is denied.)"
I don't know if this has anything to do with the error that SSMS gave me or not, but I noticed that the download doesn't even have a .LOG file, so I can't attach to that anyway.
So, is the problem that there's no .LOG file associated with the .MDF file? Or is there some other issue involved?
Kindest Regards, Rod Connect with me on LinkedIn.
May 26, 2016 at 12:10 pm
You can attach an MDF file without a log file - Click remove to remove the reference to the log file and SQL will create one for you.
You need to ensure the account the SQL service is running under has access to the location of the MDF file. Try moving the MDF file to Program Files\Microsoft SQL Server\MSSQL12.<InstanceName>\MSSQL\DATA and try attaching from here.
May 26, 2016 at 12:32 pm
The account that the sql service runs under needs full control to the location of the mdf / ldf files.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply