wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Where to store application settings ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Where to store application settings ?" Watch "Where to store application settings ?" New topic
Author

Where to store application settings ?

mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

If i got some app and i would like to store user's chosen settings, which option would be best? I got only idea to store data in sqlite or use some ini file. Put ini file would be too easy open and see sensitive data like passwords even if i encrypt them.
Bill Cruise
Ranch Hand

Joined: Jun 01, 2007
Posts: 148
Check out the Java Preferences API. You're right about passwords though, those should be stored separately in a database or an encrypted file.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30370
    
150

A database is a good choice because it is meant to store organizational information. You would still want to encrypt the passwords of course. I don't think a database is any more secure than a file for passwords though. Anyone with access could still view the encrypted password. Which SHOULD be secure either way because it is encrypted.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

Thank you all for replies and i dont know now which to choose DB sqlite or that Pref API, if the Pref API is faster then I pick that.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41601
    
  55
If this is a desktop app I'd go with the Prefs API. There's no need to start messing with a database just for storing application preferences.


Ping & DNS - my free Android networking tools app
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

Yeha i thought same, so i am going to use Pref API
//Edit
Can't find file where it stores data?
[ July 14, 2008: Message edited by: mandlar suurla ]
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

I dont want to make new topic so i use my old one. So i tried to make use of my own configure class but that wasn't good idea. I am going to use pref API, but there is one little problem, as you insert or get the data you need to provide default data, but when i am using same fields in my app many times and in some other classes its like over typing same thing.

So my idea is to use "" empty string for default. If anyone got any good solution, then please help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where to store application settings ?