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..

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:
http://download.oracle.com/javase/tutorial/jdbc/index.html
It's quite a lot to understand and learn, but its an essential basic skill for real-world commercial Java work, so its worth the effort. Good luck!

thanks ! i will try it out.

ps JDBC works with many databases, but Java's JDK current version (version 6, AKA 1.6) includes a tiny database that's ideal for learning, developing, and even running small apps. I recommend you go with that one unless yuo already have some other database installed,
http://www.oracle.com/technetwork/java/javadb/overview/index.html

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

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.

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 !

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

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.

i did it! I can access to ms access by java now...thanks everyone

Well done!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.