Currently I use XML to store specific information to correctly load a few things such as a list of specfied characters, scenes and music, Once more I use JAXB in combination with standard compression/decompression(ZIP) functionality to store a list of extrenous data. This data is called to add functionality to the character, somewhat like Skills in an RPG. Each skill is seperated into its own XML file with a grandlist which contains the names of each file with their extensions omitted and zipped in folder that gets encrypted.

At first using xml was working fine however as the skill list grow i worry about its stability. I was wondering if I should begin storing the data in mySQL. Originally I planned to simply convert everything to JSON over xml but i think possibly mySQL would be a better move.

Can anyone inform me of the key difference and pros and cons of each I guess i'm looking for the best way to store the data more conviently and would be easier to operate on. The data is mostly primatives and strings and the only arraylist of values i have i can just concat into a single field and parse later


If I am going in the right direction with XML would it make sense to convert it to JSON and use maybe Kyro or EclipseLink JAXB (MOXy)

  • \$\begingroup\$ If you for some reason decide to se a database (don't), you should consider SQLite instead of MySQL. It is designed to be used more like a file format rather than a full client-server database management system. \$\endgroup\$ Commented Aug 27, 2012 at 19:27

2 Answers 2


Databases have a quite different use case than file formats like XML.

File-Formats like XML:

  • Are saved once and loaded once per application start-up.
  • Since they are loaded once the access time after the loading is extremely fast.
  • Used for serialization and deserialization as well as configuration files.


  • Are for the most part constantly in memory.
  • Changes to the database apply directly. That means that if the application which is writing the database unexpectedly shuts down all changes except the last very few (or even those too, if the database is external) are applied either way.
  • Access time is quite slow in comparison as queries need to be parsed, hashes be calculated and other stuff.
  • Due to the other attributes they are used as "Persistance Layer" for long running applications which constantly change (servers in most cases).
  • \$\begingroup\$ i guess even for a large amount of data then XML would still be favorable over sql. My offnote question though is should i switch my xml data to json instead which seems to handle data structures better. And if so since i use JAXB would it make sense to use EclipseLink JAXB (MOXy) or Kyro? \$\endgroup\$
    – kdgwill
    Commented Aug 28, 2012 at 14:19
  • \$\begingroup\$ yes, JSON is preferable. XML was originally designed as mark up language, e.g. to give text structure, not to hold data. JSON is better for that. \$\endgroup\$
    – API-Beast
    Commented Aug 28, 2012 at 18:22
  • \$\begingroup\$ @Conversion: I've no idea about those tools, my thought would be that you load it with your current engine, then do a export from it to JSON. A bit of work but you have all the freedom you need for the export. \$\endgroup\$
    – API-Beast
    Commented Aug 28, 2012 at 18:31
  • \$\begingroup\$ yeah i figured as much just was't sure what lib i would use to parse it. \$\endgroup\$
    – kdgwill
    Commented Aug 28, 2012 at 19:36
  • \$\begingroup\$ Changes to a database do not have to be applied directly. By using Database Transactions, you can define a unit of work that has to be complete before the changes are actually committed. It would require some work though and your chosen technology should support that... ;) \$\endgroup\$
    – Timo
    Commented Sep 7, 2012 at 10:01

If this is just simple, local information, then storing it in any kind of "database" is massive overkill, let alone something like MySQL. SQLite might be appropriate.

These data seem to be for game concepts. So don't forget: you need to author this data. It's a lot easier to hand-edit XML/JSON/etc than it is for some kind of database. You can even develop tools to validate XML, thus making sure that values are within acceptable ranges. If you use something like a Lua script, you can even have dependent properties, where changing one value can change it globally across all scripts.

Considering how easy it is to author text, and how hard it is to author databases (unless you want to write a specialized editor program), I see no reason to use databases for this at all.

  • \$\begingroup\$ Thats what i figured but then i also realized that the amount of differnt "Skills" where increasing and was wondering if it would be really annoyting to handle individually in the future the way it is. I actually used a editor to create all of the "Skills" so once everything is set up correctly it shouldnt really be an issue. Once more to the players they only attain an instance of a specific skill information and nothing really changes besides possible adjustments later on and it should also be noted that their is network functionality that when connected also asks for this bit of data. \$\endgroup\$
    – kdgwill
    Commented Aug 27, 2012 at 18:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .