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!

  • 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 – チーズパン May 17 '13 at 10:06

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: https://stackoverflow.com/q/10366586/27535

  • 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? – チーズパン May 17 '13 at 10:26
  • 1
    @bodycountPP: yes, this is a solution too. – gbn May 17 '13 at 10:34

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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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