views:

136

answers:

4

I have a text file, it's a XML file. This is the configuration that the users upload.

The issue now is should I store this file into the database straight? Or should I put the file in one directory, and inside my db I point to the location of this file?

+1  A: 

Store it in the db. That way it is subject to all the same protection and auditing that the rest of your data in the database is.

Brian Agnew
A: 

Storing it in the DB is a good first step.

You may find that this suits your needs or that it is very slow, especially if you wanted to query things in the configuration.

Then you have two good options, some databases can support XML as a data type and run xpath queries on it, or you may find that you want to parse it on upload and store the data in relational tables.

Jeremy French
A: 

During production, store it in the DB, BUT during development be sure to have a way to access the config file in some other way, such as command line path, or whatnot, because you'll need to tweak the config file quite often (probably) and editing it in the DB will be a pain.

Robert Gould
A: 

Up to 1 MB or even a bit more, I would recommend putting it into the database.

Storing it externally always causes grief when trying to keep things in sync - is the file still available at the location stored in the database?

SQL Server 2008 has a nice new feature called FILESTREAM which works well for storing files in the filesystem and maintaining integrity. But that really only kicks in when you have files that are significantly larger than 1 MB.

Marc

marc_s