GeeCON Prague 2014*
The moose likes Java in General and the fly likes Read configuration from database instead of a config file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Read configuration from database instead of a config file" Watch "Read configuration from database instead of a config file" New topic
Author

Read configuration from database instead of a config file

Pavan Kumar
Ranch Hand

Joined: Jan 23, 2004
Posts: 78
Hi Friends,

I have been working on stand alone application that reads application configuration from properties files.

I was thinking if it would be a better idea to store them in a table in the database.

This way, changes would be propagated faster
if we need to update a particular property, we don't necessarily have to go through the whole release cycle.

But this could be a disadvantage as well, as we are introducing un-tested features.

But these configuration changes do not happen often and if ever it happens we would actully know the risks.

What are your thoughts and experiences on this?

I would appreciate if someone throws some light on this.

Thanks,
Cnu
[EDIT] fixed subject to be more meaningful ( I think )
[ September 28, 2006: Message edited by: cnu sri ]

formerly known as Cnu
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I introduced a configuration database table for just the reasons you describe, plus one more. Our deployment people want to deploy an EAR file and nothing else. So the config files must be in the EAR and since we cannot modify the EAR that makes them the same in all environments: test, qa, s&p, training, prod, etc. We have quite a few things that must vary in each environment, so those go in the database. It's set up so a configuration file overrides the database. That lets a developer customize his own environment through files without changing a shared database. The configuration module has a lazy cache to improve performance and an administrative dashboard to clear cache and bring in changes.

Any of that sound good?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Pavan Kumar
Ranch Hand

Joined: Jan 23, 2004
Posts: 78
Stan,

Thanks very much. Yes, that definitely feels more assuring. Specially the idea of overriging the default properties with a config is very cool.

Thanks,
Cnu
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Read configuration from database instead of a config file