is it better to store platform configuration in database or a file?

configuration, database, file

Solution

It really depends on your application.

Storing the settings in the database has several advantages:

- Security - users can easily alter settings in the file or overwrite the contents.

- For Distribution - the same settings can be updated and loaded onto any machines on the network.

Disadvantages:

- Relies on database connection

- Overhead when reading from database

Storing in file advantages:

- Fast and easy to read and modify.

Disadvantages:

- Security issue as mentioned above.

- May need encryption on sensitive data.

- Versioning is difficult, since you have to create separate files for different versions.

it means that each time we add a platform setting we have to add a column to this table - depending on what database you are using, but you can store the whole settings as XML (SQL server allows this) in the table, so you do not need to alter the table schema everytime adding a settings; all you need to do is to modify the XML, adding elements to it or removing from it.

but in the end, you have to decide yourself, there's no better or worse for everyone.

Problem

currently we are developing an app in which we use database table to store platform settings, like maximum file size, maximum users number, support email, etc. it means that each time we add a platform setting we have to add a column to this table. in my previous projects i am used to store such information in file. what is better/faster approach? ps, i am almost sure someone already had such question, but i can't seem to find it

Original source