placing properties in database instead of property file placing properties in database instead of property file database database

placing properties in database instead of property file


Advantages if you place it in DB.

  • It can be centrally shared.
  • If you want to retrieve particular key you don't need to load whole data you can uniquely obtain value from key.
  • DBMS is always reliable then File IO.

Advantages of Properties file :

  • if data size is smaller then storing it in properties file would be beneficial.


It really depends. But in generic cases:

Use a PropertiesFile when:

  • Those properties are needed to connect to the database.
  • When there is no database involved

Use a Database Table when:

  • Database states could change the values
  • When your application uses a database
  • You need the flexibility of different properties depending on the database that is connected to.

In all other cases, the decision is on the fence and it doesn't really matter which way you go.


It all depends is probably the correct answer here.

Our solution:

All our products to first check -D command-line (when building), then PATH, then the Configuration-directory set up on our local machines, and finally default to the data base.

ie. For production and system-test we load properties from the database, for everything up to that point we override with property-files.