.MDF association errors
I am working with the sample adventure works database and My computer for some reason after I downloaded it associated all .MDF files with Daemon Tools. I have tried associating it with the Server Management studio for SQL 2012 for developers EXTREMIS\MSSQLSERVER but to no avail I cannot get it to register or install or whatever I need to do to the .MDF in order to view it when I attach it as an external data source from LightSwitch as a database.
September 20th, 2013 1:34am

Hi reigh7,

There are two different methods for getting this on your computer.  From within SSMS click on new query then execute the following queries.  

USE MASTER;
GO
This is an excerpt from the codeplex page for the adventureworks database.  Please note you will need to update the filename to point to the correct .mdf and .ldf directories.
CREATE DATABASE AdventureWorks2012 ON (FILENAME = 'M:\Data\AdventureWorks2012_Data.mdf'), (FILENAME = 'L:\Tlogs\AdventureWorks2012_Log.ldf') FOR ATTACH;

http://msftdbprodsamples.codeplex.com/releases/view/93587

The second method is listed in the link above under the section "To attach an AdventureWorks database"

Please click the Mark as answer button if this solution works for you, and vote as helpful.   
Thanks!



Free Windows Admin Tool Kit Click here and download it now
September 20th, 2013 2:03am

Hi reigh7,

There are two different methods for getting this on your computer.  From within SSMS click on new query then execute the following queries.  

USE MASTER;
GO
This is an excerpt from the codeplex page for the adventureworks database.  Please note you will need to update the filename to point to the correct .mdf and .ldf directories.
CREATE DATABASE AdventureWorks2012 ON (FILENAME = 'M:\Data\AdventureWorks2012_Data.mdf'), (FILENAME = 'L:\Tlogs\AdventureWorks2012_Log.ldf') FOR ATTACH;

http://msftdbprodsamples.codeplex.com/releases/view/93587

The second method is listed in the link above under the section "To attach an AdventureWorks database"

Please click the Mark as answer button if this solution works for you, and vote as helpful.   
Thanks!



September 20th, 2013 2:03am

I wasn't tying to double click on it I was in Lightswitch and typed in the Server name first then I tried selecting the database from the drop down just like in the example but it is not there. I was then checking things by trying to open it with SQL Server Management studio so I can make sure it is available on the server "loaded" and had the issue it will not load so I figured that was because it was showing up as associated with Daemon tools. I got all the way through the steps except the last two were 8 & 9 not sure where those ok buttons are located I did set the MDF and the Log ... buttons if that is the same thing as steps 8 & 9 but it did not work I press the final ok of the attach databases window and get an error saying refer to the hyperlink in the message window but there is also no hyperlink.

It was just so frustrating just trying to find the instructions for this in the first place I went through the whole codeplex page before coming here and still missed the below list. I just wish if there is going to be a Lightswitch tutorial that implied you already had an instance of an SQL server and attached it using these steps and then you can "attach to that external source" with Lightswitch it might have saved me two days of frustration to just mention that in the tutorial. I mean lets be honest installing SQL server is no simple application install either you have to launch that from a separate tool. The real frustration I am just doing this tutorial on light switch so I can do another tutorial so I can see if these two blogs contain the information I need (http://blogs.msdn.com/b/eric_erhardt/archive/2012/04/17/executing-a-simple-stored-procedure-in-lightswitch.aspx, http://blogs.msdn.com/b/eric_erhardt/archive/2012/04/19/updating-records-in-lightswitch-using-stored-procedures.aspx) to actually figure out why my command table process thinks uses processing power but does not produce a result I can find on my system. All so I can prove my idea that I will never be paid for anyways just so I can be at peace that I did all I could.

To attach an AdventureWorks database
  1. Download a database for your SQL Server version.
  2. Unzip the database (mdf) file and log (ldf) file.
  3. From Microsoft SQL Server Management Studio, connect to a SQL Server instance.
  4. Right click Databases.
  5. Click Attach.
  6. Click the Add button.
  7. Locate the AdventureWorks database mdf file. For instance, AdventureWorks2012_Data.mdf.
  8. Click the OK button on the Locate Database Files dialog window.
  9. Click the OK button on the Attach Databases dialog window to attach the database.
Free Windows Admin Tool Kit Click here and download it now
September 20th, 2013 5:00am

. I have tried associating it with the Server Management studio for SQL 2012

You can not open a .MDF database file directly with SSMS, you must "attach" the database file to SQL Server first, as you described it in your last post.
September 20th, 2013 7:07am

Yeah I figured that out anyways it was just me saying what I had already tried so we didn't go down the same paths again. I had found blogs suggesting that said associating it with the server manager was somehow the solution.

The issue may be "windows firewall" during the installation of SQL server I got warning and a link on which ports needed to be open and how to open them up for SQL Server but the link was dead leading only to a blank search screen. I could not even find which ports should be open and do not want to just start cracking open my computer I/O without some certainty of the security issues, or a very reputable source of which ports to open.

After I finished last night I noticed in the top dialog if I scrolled over I could find the error details SQL server gives me when I try and attach a database and I am getting an access denied error even though I am the administrator so it must be the firewall.

Free Windows Admin Tool Kit Click here and download it now
September 20th, 2013 8:43pm

 I am getting an access denied error even though I am the administrator so it must be the firewall.


Your permissions doesn't matter here, it's the SQL Server with it' service account permissions accessing the database files and the service account don't have enough permissions, therefore you get the error message. As it's best locate the MDF/LDF files in the DATA subfolder of your SQL Server installation, here the service account do have enough permissions.
September 23rd, 2013 5:21am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics