CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: XML vs Database

  1. #1
    Join Date
    Jun 2010
    Posts
    0

    XML vs Database

    Hello,

    in a new project that i'll have to develop i need to decide whether i'm going to use XML or a database to store the data used by the project.


    There wont be many or frequent operations on the data, Also, there won't be concurrent user-access on the data. The data will only be read once when the application starts and will be saved only when the user chooses to do so.
    Multimedia files (mainly images, but also movies and audio files) will be part of the stored data.
    The structure of the data will be hierarchical, which xml supports very well.

    Would it be better to use one or several XML files (probably packed in a jar-file together with the mutimedia files), or should i use a real database like mysql / some embedded database?


    Thanks for any input

  2. #2
    Join Date
    Apr 2009
    Posts
    598

    Re: XML vs Database

    The data will only be read once when the application starts and will be saved only when the user chooses to do so.
    Windows (if that's your operating system) gives you another solution, which is to manage your own initialization file (your own ".ini" file) with WritePrivateProfileString() and GetPrivateProfileString(), see http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx .
    Multimedia files (mainly images, but also movies and audio files) will be part of the stored data.
    You should have told it first. Usually, big files are not stored in a database or in an XML file. They are places in a directory and only the path to the files are stored in a database or an XML file. In that case, you could also store that path in an initialization file.

    So my preferred solution is the initialization file, because it is very easy to use (only two functions, no need to open files or connections, etc.) and very light (no need to install additional things, to link with libraries, etc.). Some people would argue, it is not very fast, but I have seen it is fast enough for me. Windows' initialization files are not very well known and it is a pity because they have a lot of advantages.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured