0

guys, i have a project that have to implement a reservation system by using java. Is it database the only way to store the data? Is there other method beside by using database? If database is the only way to do that, can anyone tell me how to do so in the code? i have seen so many thread inside here..but thre are a lot of them and each of them are different...im confusing which one is the correct one..Please give me your opinion thanks..

4
Contributors
11
Replies
12
Views
6 Years
Discussion Span
Last Post by JamesCherrill
Featured Replies
  • No, it's not the only way, but it's the way that people use 99% of the time. You will find some excellent tutorials on the web for using Java with a database. I recommend this one: [url]http://download.oracle.com/javase/tutorial/jdbc/index.html[/url] It's quite a lot to understand and learn, but its an essential basic … Read More

0

no idea how to start...perharps..can i do it in other way beside database?

0

can i do it in other way beside database?

Yes but.
As an alternative you could design a way to use files and folders to store your data.
The keyword here is design.
Some day though you will have to learn databases.

0

Yea...my lecturer did mention that i could use a file to store the data. But i was just try if i could do it in database...But now i realise that its too complicated for me. I just start learning java for less than 2 month. Anyway , thanks for your help !

0

OK. Here's the quickest way to do it. First, make sure that the data you need to save is held as instance variables in one or more objects in your program. Then do this: (words in italics are things you can look up in the Java API documentation)
create a File object to hold your data. create an ObjectOutputStream using that file. Use the writeObject method to write your program's objects to the file. To get it back, use an ObjectInputStream and its readObject method to get your objects back

0

I think the OP should design how and what data needs to be read/written/updated before deciding on what technique to use to hold the data on disk.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.