Placing properties in a database instead of a properties file

Java, is it better to place and load properties from a database instead of a properties file?

+6
java database properties load
source share
3 answers

Benefits if you put it in a DB.

  • It can be divided in the center.
  • If you want to get a specific key, you do not need to load the whole data, you can definitely get the value from the key.
  • DBMS is always reliable, then File IO.

Benefits of the properties file:

  • if the data size is smaller, and saving it in the properties file will be useful.
+4
source share

It really depends. But in general cases:

Use the Properties property when:

  • These properties are required to connect to the database.
  • When there is no database involved

Use a database table if:

  • Database Status May Change Values
  • When your application uses a database
  • You need the flexibility of various properties depending on the database you are connected to.

In all other cases, the decision is on the fence, and it does not matter which direction you are going.

+3
source share

It all depends, probably, on the correct answer.

Our solution:

All our products for the first check -D command line (when creating), then PATH, then the configuration directory configured on our local machines, and finally, the default database.

T. For production and system testing, we load properties from the database, and until now we redefine the properties files.

+1
source share

All Articles