Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

placing properties in database instead of property file

Java, is placing and loading properties from database instead of property file is better approach ?

like image 771
d-man Avatar asked Jan 26 '11 11:01

d-man


2 Answers

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.
like image 67
jmj Avatar answered Sep 22 '22 05:09

jmj


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.

like image 39
jzd Avatar answered Sep 19 '22 05:09

jzd