Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using an XML file as a database from a Java application - Possible?

Posted on 2009-03-30
8
Medium Priority
?
443 Views
Last Modified: 2013-11-23
Hi Java experts,

I was wondering if it is possible to interact with an XML file just like you would interact with, say a MySQL database. I've looked at JAXB, JiXB, and a host of other frameworks that let an application transform an XML document into an object tree. The data can then be manipulated and marshaled back into XML.

What I wanted to know is that is it possible for multiple users to be using that application as an interface to interact with the XML file to create, update, or delete "records", while ensuring data integrity, just like you would in a database?

Any comments/advice will be greatly appreciated.
0
Comment
Question by:FaTaFaT
  • 4
  • 4
8 Comments
 

Author Comment

by:FaTaFaT
ID: 24024920
Thank you for your response.

These are wonderful suggestions. However, my situation is that I want a solution where nothing has to be installed. This is because it is a school project and unfortunately the instructor may not want to install these tools at their end when they try to run my code. I'm sorry I didn't mention this in my question.

The project requirement says: develop an application that supports multiple users with varying user privileges, to interact with data in different ways. Typical examples provided by the instructor were: book club application, or a travel agency application.

So, is there any other way, if not through XML, that is not dependent on having certain tools installed to achieve all this in Java?
0
 
LVL 92

Expert Comment

by:objects
ID: 24024994
you'll need to build that sort of functionality yourself. java doesn't come with support for using xml as a multi user database

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:FaTaFaT
ID: 24025081
I see. So, is there any resource / library / api that I should consider in trying to figure out how that sort of functionality can be built?
0
 
LVL 92

Accepted Solution

by:
objects earned 750 total points
ID: 24025138
you could just use object serialization

0
 

Author Comment

by:FaTaFaT
ID: 24025625
Thank you for pointing me in the right direction. Following your suggestion, I have read quite a few internet resources on object serialization. However, there is still one question that I couldn't find the answer for. What happens when there are multiple sessions? ie, many users de-serializing the same object file at the same time and trying to commit back different updates. Are all the updates serialized back into the object file in a coherent fashion (proper merging, avoiding race conditions, etc.)?
0
 
LVL 92

Expert Comment

by:objects
ID: 24025668
you would manage that from your application, for example using synchronisation

0
 

Author Comment

by:FaTaFaT
ID: 24025689
Alright. I'll look into that too. Thanks for all your comments and suggestions "objects".
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question