Reputation: 12459
Lets suppose I'm building a web application and wonder where to store configuration values (e.g. key-value pairs). It is expected that those pairs will be looked up by keys.
What are the advantages and disadvantages of storing those values in a relational database in comparison to storing them in a configuration file (such as an .ini file)? Are there other possible solutions?
As pointed out by @DisgruntledGoat in his answer, in case of user-specific configuration values, a relational database is the right option.
I am more curious about non-user-specific configuration options, such as let's say the threshold of my logging system, or the number of articles to show on homepage. Configuration files (such as ini files) were designed for that purpose, but I have seen people storing them in a database a few times as well.
Upvotes: 1
Views: 162
Reputation: 72530
There isn't much difference, but the advantage of a database is you can fetch only the values you need. It's also better if you have per-user options.
One other option if this is a downloadable app is to have a file in the native language you are using, eg PHP. Then you just include the file and have the options there.
Upvotes: 1