Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML or Database?

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you prefer? XML or Database? For storing things like configuration, which will not grow with time.

My personal choice is XML.
 
Henry Wong
author
Marshal
Pie
Posts: 21123
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One is a data format, the other is a storage mechanism. It is not either or. It is possible to store XML in a Database.

Henry
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:One is a data format, the other is a storage mechanism. It is not either or. It is possible to store XML in a Database.

Henry


Okay. Agreed.
But you do can store (keep) data in XML file.

Let me rephrase my question. What do you prefer? XML file or Database?
 
Henry Wong
author
Marshal
Pie
Posts: 21123
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ankur rathi wrote:
Let me rephrase my question. What do you prefer? XML file or Database?


Never really thought about it that much. I have done both.

Wrote lots of programs that read and save XML data as XML files.

Wrote some programs that parsed and save XML data in databases. Of course, you can argue that the data wasn't XML data anymore, as it has been parsed.


In a few cases, I did save raw XML data in a database. But in those cases, it was a corporate wide database. It was the best location to store something that was accessabile from everywhere in the company, was kept up at all times, was automatically backed up, and made highly available.

Henry
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I depends on the amount of data you will be storing. I have used XML files a few times when the amount of data was very small - the XML files never grew larger than 100KB. I usually read the file at startup and re-wrote the file any time any data changed. I expected at most 2 or 3 users, but I still synched the data changes.
 
Praveen Rajendran
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to comment on this way from an enterprise application standpoint...

XML files are good for storing configuration parameters which determine connectivity to external applications as you can carry those files always along with the application archive (deployable component)
Databases would be preferred for lookup data and storing those details which you do not wish to package along with the application.

In general databases are by default deemed for storing data while XMLs are more preferred to be used as means of propogating stored data rather than storing as static for frequent retrieval. If XMLs are used to store data then need to look for servers to store the XMLs itself.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically, like Praveen, I would store data in an XML document if I planned to update that document as a whole document, occasionally. So it would be useful for configuration files. If I planned to update small pieces of the data frequently, like keeping track of orders for a set of customers for example, I would store the data in a database.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the type of data being stored. SGML-based or XML-based data files are the best practice for storing text-based content for technical manuals, books, CD-ROM, professional/legal information, etc. In many cases SGML/XML data files are in Giga/Terra byte range.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic