Originally posted by saumil baxi: Hi, I am creating one application in which i dont want to use normal properties file for storing the configuration.
I want to put all my configuration in database and provide an API for fetching the configuration..
Can any one give me some path forward. How should i design my database and API..
Welcome Saumil in Javaranch.
Property file contains key value pairs, the same way you can construct table such as cofing_property in which key and value(s) are columns. But if you would like to use properties as per user (or any other criteria) then you have to add one more column.
Regarding API, I will suggest you to have Helper class which is populate Hashtable or your favorite collection as per table values. And in Helper class you will have getter method to fetch value from collection.
I guess it won't be a good idea by storing the configuration in database because to fetch this configuration, you some how need to connect to database initially. For that if you donot want to use your properties file, I guess you need to hardcore the code, which is not a good practice.
Most of the times, lesser hits to the database is recommended for optimum performance.
Are you planning to create your own API classes for the database connection?