Discussions

General J2EE: XML query or SQL query?

  1. XML query or SQL query? (3 messages)

    I am in the conception phase of a web application and i have to autodetect the modules installed in the application on the main page and i dont want to edit it in the jsp page. I tought about two solutions: create an xml file that contains the module names or simply put the modules name in a database table. I know that xml should be better for a configuration point of view but i never used xml query, it needs more coding than a simple db call? Is it more performant? Thank you

    Threaded Messages (3)

  2. How dynamic is the data? If it will change a lot, a DB is good. Even if it won't, a DB is good for storing data. That should already make sense. :) Don't overuse XML. It's really only good for cross-platform information exchange and not editing by hand (or as a relatively static file-based DB that's edited with tools.) If you are editing by hand, a properties file may even be better suited to the task.
  3. If the web application is not using a DB, don't introduce a DB solely for configuration. If the configuration is simple, you can use properties files. However, be aware that if you start to add a lot of configuration, properties files are harder to maintain and you will probably find yourself switching to XML. If you want to use XML you can used something like Spring or Jakarta Commons Digester to inject the configuration into Java Objects instead of reading the XML files. The downfall of Spring is that the XML file will be hard for non-Spring users to interpret. In Digester, the XML file will look however you want it to look.
  4. Re: XML query or SQL query?[ Go to top ]

    I am in the conception phase of a web application and i have to autodetect the modules installed in the application on the main page and i dont want to edit it in the jsp page. I tought about two solutions: create an xml file that contains the module names or simply put the modules name in a database table. I know that xml should be better for a configuration point of view but i never used xml query, it needs more coding than a simple db call? Is it more performant?

    Thank you
    From what I understood... You want to auto-detect the modules.. which means modules should register themselves at a place where you can look for the regestired entried. For this first choice would be a DB where each module would place its entry when they are loaded. Second would be to implement a simple shakehand API in each of the modules, Before displaying your page you could try to shakehand with all the possible modules you know and you can display the modules that have been succefully comepleted a shakehand. Second option would all be an autodetect and can also reflect if there is a problem in your module and was shutdown. Krishna