Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently worked on a problem caused by an application storing the wrong location of MSSQL .ldf and .mdf files. The SQL Server was 2005.

The application was looking for the files in: \server\app root\database\data and \server\app root\database\log, but the files were in \server\mssql\data and \server\mssql\logs. I moved the database files to the location where the application was expecting them, which fixed the problem.

I don't understand why an application would need to know where these files are, it should only care about an ODBC name, or OLE access (host name, credentials). Does anyone know why an application would need this information?

share|improve this question
Probably because the developers hadn't been hit around the head with a cluestick enough. Where was the app storing this information? – Sim Nov 6 '09 at 1:55
I'll post that tomorrow when I'm at work. – Eric H Nov 6 '09 at 2:19
It's very strange, the registry contains the DB hostname and username, but the password for the username is hashed (some custom hash, by the look of it) and stored... in the database. I'm obviously missing something. – Eric H Nov 6 '09 at 18:01
up vote 1 down vote accepted

SQL Express (only Express) allows a feature called User Instances in which you can specify the location of a .mdf file in an app's connection string, using the SqlClient Managed Provider, and it will be attached as a database on the server. There are some limitations to this:

  • You can only use local connections (ie- SQL Express has to be local to the web server)
  • No distributed queries
  • No replication

When this feature is used then the server admin does not create the database on the server. SQL attaches the .mdf file when the connection is made to the app.

You see this most often with some (brainless and/or cheap) web hosts, and also when SQL Express is used as the db engine for a local user app.

From a web app perspective it makes your database fairly portable and does provide an alternative when you're not able to run a backup of your database through a hosting control panel or something. Otherwise I've found that it's biggest use is in the local app arena.

share|improve this answer

Unless we're talking about software that, for whatever reason, needs to directly access those files there is no reason for it to know about them. Even then, it's just plain bad and inconsiderate programming to make assumptions or have unrealistic expectations about such details. The software should, at the very least, ask you where the files are if it can't locate them on its own. I certainly agree with Sim, that programmer(s) definitely needs a few whacks with the cluestick. You really have to wonder what else is wrong with the application.

share|improve this answer

Your Answer


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.