2

全て:

構成データを維持するシナリオがあります。私の理解では、構成データはプロパティ ファイルまたはフラット テーブルに格納できます。

私は、いつプロパティを使用し、いつデータベース テーブルを使用するかを示す有効な境界を探しています。

私の理解では、構成データをプロパティに保存することは、データベースよりも API のコストと効率 (Java ベースのアプリの場合) の方が安価です (この目的のために接続を確立するのはコストがかかるため)。

あなたのコメントは大歓迎です!

ありがとう。

4

4 に答える 4

7

I would assume you'd only load the configuration data once or rarely anyway, so I wouldn't worry too much about the performance side of things. A few points to consider though:

  • If you don't just need name/value pairs, a database is likely to provide a richer data model.
  • Storing the configuration in a database is likely to make it easier to share between multiple computers
  • Even with configuration in the database you'll need to configure the database connection itself...
  • Using a database for configuration if you don't need a database for anything else would seem a little odd, although you could potentially consider using an embedded database such as SQLite instead of a traditional client/server one.
  • Don't forget there are other alternatives beyond the two you've mentioned
于 2012-04-05T10:39:13.330 に答える
2

A properties file contains static values, fixed at compile time (or deployment time). A database contains dynamic values, that you can change while the application is running.

于 2012-04-05T10:39:54.670 に答える
-1

There is comparision between Properties file and database. Properties file stores key value pairs separated by = or : and both key and value must be string.

You can store any data in a 2d tabular format in database.

于 2012-04-05T10:39:34.787 に答える