1

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!

asked May 17, 2013 at 9:32
2
  • Which DBMS are you using? Postgres? Oracle? Microsoft? (SQL is just a query language, every RDBMS is a "SQL database") Commented May 17, 2013 at 9:38
  • I am using Microsoft Commented May 17, 2013 at 10:06

2 Answers 2

5

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

answered May 17, 2013 at 9:58
2
  • 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? Commented May 17, 2013 at 10:26
  • 1
    @bodycountPP: yes, this is a solution too. Commented May 17, 2013 at 10:34
1

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

answered May 17, 2013 at 12:20

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.