• Post Reply Bookmark Topic Watch Topic
  • New Topic

Best approach to storing configuration variables?  RSS feed

 
Tivona King
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a configuration variable that I want to store (y/n flag). I'm using websphere in a clustered environment. Is it better to store in database, .property file, JNDI, or websphere environment variable? I would like to find the pros and cons of each.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

What the best place is to store configuration variables depends on your application - it's hard to give a general answer to your question. In the project that I'm currently working on, we store configuration information for the web applications in a database. But it could equally well have been stored in a *.properties file or in JNDI, or somewhere else.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It also depends what you want to do with it. If you want to change it, you'll need to make sure you are the only one who will access that file / database record / ... at that moment, or you may run into problems. If this is the case, a database table would be the easiest.

If it's a read-only property you won't really get this problem, so it doesn't really matter as far as concurrency is concerned.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!