How do you structure config data in a database?

后端 未结 18 1264
后悔当初
后悔当初 2021-01-31 04:37

What is people\'s prefered method of storing application configuration data in a database. From having done this in the past myself, I\'ve utilised two ways of doing it.

18条回答
  •  醉话见心
    2021-01-31 04:55

    It seems overkill to use the DB for config data.

    EDIT (sorry too long for comment box): Of course there's no strict rules on how you implement any part of your program. For the sake of argument, slotted screwdrivers work on some philips screws! I guess I judged too early before knowing what your scenario is.

    Relational database excels in massive data store that gives you quick storing, updating, and retrieval, so if your config data is updated and read constantly, then by all means use db.

    Another scenario where db may make sense is when you have a server farm where you want your database to store your central config, but then you can do the same with a shared networked drive that point to the xml config file.

    XML file is better when your config is hierarchically structured. You can easily organize, locate, and update what you need, and for bonus benefit you can version control the config file along with your source code!

    All in all, it all depends on how the config data is used.

    That concludes my opinion with limited knowledge of your application. I am sure you can make the right decision.

提交回复
热议问题