I have a situation to choose between parsing XML documents in Oracle PL/SQL and parsing them in Java. The system receives the XML documents on a message queue and so the XML documents are not on the file system, unless I write them to the filesystem after read开发者_StackOverflowing from queue. And, the intent of parsing is to insert/update records in a bunch of database tables.
Which one is a better option from a performance stand-point?
It's really a competition between PL/SQL and many possible Java parsers. It's very likely that some of the Java parsers beat PL/SQL on performance.
Some other reasons to go with a Java parser:
- License costs will be much less.
- You're not chained to a particular database.
- Your solution has more deployment options.
However if you need to extract information from the XML and insert it into an Oracle database, the advantage might go to PL/SQL. In this case it might be worthwhile to prototype both approaches and see. Also consider the development time needed for each: if the number of bytes of XML coming into your system is relatively small, just pick the solution that's fastest to implement.
I'd say Java as if you wanted to horizontally scale (ie. add more servers) then the licence costs of Oracle might prevent this.
Adding another App server just to parse XML with Java is cheap by comparison.
Also (flamebait) DBAs are grumpy.
精彩评论