Java, Best way to store information?
Lets say I was to create a program, have a login, register database and everything. Now my question is what is the best way to store information even when the program ends. My old possibility I know is to read and write to a file. But I thought their has to be something more than just that.
Right now, for tommorow I have JDBC i'm going to learn. Is that the answer to my problem? Or what other ways is there, and what's the best/most commonly used in a business invironement/freelancer.
Please elaborate on the concept in general, going through all the possibilities to the advantages or disadvantages to each if you may.
Re: Java, Best way to store information?
You're asking questions that aren't really answerable- it all depends on your exact context, what you're planning on doing in the long run, your current skill level, etc. Stop worrying about "the best way" to do things and just do them in a way that makes sense to you.
That being said, if you have a login/registration database, can't you just use that? Or you could look into serialization or outputting xml or a simple text file. Or you could use save passcodes that get hashed to states somehow. There are probably many more options
Re: Java, Best way to store information?
Ok thanks, I wasn't too sure if their were more ways. But they must be alot more complex than I am.
Should I stick to simple text file?? Will it be useful in the long run?
Re: Java, Best way to store information?
Quote:
Originally Posted by
Emperor_Xyn
Should I stick to simple text file?? Will it be useful in the long run?
Like I said, that's completely up to you. If simple text files serve your purpose and fit into your brain, by all means go for it. You might also want to look into serialization though.
Re: Java, Best way to store information?
Thanks mate, I will google serialization now. I'm always up for learning something new.