We need to develop a Java application that will read the around 5000 records from a oracle database and write them XML file (size around 5 MB). We have following architecture in mind.
1. This application will read a xml configuration file which will contain all the configuration related information and queries to be executed.
2. Application will parse, validate this XML and extract all the queries to build query objects.
3. These query objects will execute the queries and build a DOM tree in the memory.
4. This DOM tree object will be written to the hard disk as a XML file.
Please let us know if any performance and memory issues in this.
Thanks
Sabir
-
XML/Java Help (4 messages)
- Posted by: Sabir Jana
- Posted on: October 03 2002 01:48 EDT
Threaded Messages (4)
- XML/Java Help by Lasse Koskela on October 03 2002 05:54 EDT
- XML/Java Help by Gal Binyamini on October 03 2002 10:19 EDT
- XML/Java Help by Burak AKSOY on October 04 2002 01:02 EDT
- XML/Java Help by Brian Chan on October 04 2002 10:14 EDT
-
XML/Java Help[ Go to top ]
- Posted by: Lasse Koskela
- Posted on: October 03 2002 05:54 EDT
- in response to Sabir Jana
If the 5000 records you mentioned are all of the same "type" (and there isn't a tree-like hierarchy present), I would suggest avoiding DOM.
If you are able to do something like this...
write XML header
for all records in resultset {
write record in XML format
}
write XML footer
...you'll avoid keeping the 5 meg chunk in memory (actually could be more than 5 megs), which is quite a relief for the hardware. -
XML/Java Help[ Go to top ]
- Posted by: Gal Binyamini
- Posted on: October 03 2002 10:19 EDT
- in response to Sabir Jana
If you have an option, I suggest you use SAX rather than DOM. SQL query results are streamed to you, and there's no need to create a bottle-neck that will stop the stream-lined process. If you just write the result as you get them, your performance and memory footprint will be much better.
Gal -
XML/Java Help[ Go to top ]
- Posted by: Burak AKSOY
- Posted on: October 04 2002 01:02 EDT
- in response to Gal Binyamini
Also be careful at String operations if you need to do. -
XML/Java Help[ Go to top ]
- Posted by: Brian Chan
- Posted on: October 04 2002 10:14 EDT
- in response to Sabir Jana
Only if you can use Oracle specific solution, try to use the XML features inside Oracle Database. For Example, if you just need to return the result set in XML format, why not call a Stored Procedure(PL/SQL) that returns the resultset in XML in a CLOB object. Packages are available in PL/SQL that construct xml file from a SQL query. Again,this is not an option if you are looking for vendor-neutral solution.