Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am working on a project for a very long time now. It's a .NET application which works with a SQL Server database (.mdf, LINQ to SQL). Now I am almost finished and wanted to run some tests.

But here is where I totally screw up. Until now I had my application only running on my own pc with the .mdf file being stored locally. What I actually planned was an application which connects to a database stored on a networkpath from different machines.

Now I am reading that this is not possible with SQL Server databases?! And I also get the message:

The file xxx.mdf is on a network path that is not supported for database files.

Can anybody think of an option how I could solve this problem without reprogramming the whole database stuff again?

One possible a clearly desperate solution I thought of first, was to:

  1. Let my application find the database file on the network path
  2. Copy the .mdf + .log files to a local folder
  3. Do the Read/Write operations...or whatever the user wants to do
  4. And at the end copy/replace the whole .mdf + .log files back to the network folder

If there is no other solution for my problem, would my solution work? If it would, what would be a possibility to avoid concurrent updates?

Please help and thanks in advance!

share|improve this question
    
Which DBMS are you using? Postgres? Oracle? Microsoft? (SQL is just a query language, every RDBMS is a "SQL database") –  a_horse_with_no_name May 17 '13 at 9:38
    
I am using Microsoft –  bodycountPP May 17 '13 at 10:06
add comment

2 Answers

up vote 5 down vote accepted

An MDF files is not the database, as such. It is merely the on-disk storage used by the SQL Server database engine.

When your app "uses" the MDF, it is actually attaching them to an SQL Server install and running queries against that. This is transparent really.

Instead of this, you can install SQL Server on the network (even Express edition), attach tehe database, and connect to that from all your app installations on the network.

This SO answer has way more details: http://stackoverflow.com/q/10366586/27535

share|improve this answer
    
Would it also be possible to install SQL server on a pc and then connect to the db on this machine via network from other PCs? –  bodycountPP May 17 '13 at 10:26
1  
@bodycountPP: yes, this is a solution too. –  gbn May 17 '13 at 10:34
add comment

You can have database files on network mount-points in SQL Server 2012. See http://support.microsoft.com/kb/819546 for more information.

However, what you're suggesting does sound like you really need to use a single SQL Server instance that can be accessed by all your users, in much the same way that you would have a file server, or an exchange server...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.