Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DocumentBuilder.parse() fails after CLOB is updated

5566Nov 29 2006 — edited Feb 27 2007
I have written a java application that reads XML content stores in a CLOB column in a 9.2.0.5 database. The application works just fine until the contents of the CLOB is modified, then I get the fatal error shown below.

I am using classes from the javax.xml.parsers.* package to process the XML content. Using an OracleStatement and OracleResultSet I read the CLOB column into a CLOB variable (named clob) using the getCLOB() method. I then create an InputSource using the following statement:

InputSource source = new InputSource(clob.getAsciiStream());

and then create a Document using the following the statements:

builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
outDoc = builder.parse(source);

The parse method works fine until the CLOB is updated (using TOAD) and then it fails. I have modified the program to print the contents of the CLOB using the methods described in the Oracle JDBC guide; using a while loop, CLOB.read() and StringBuffer. I have noticed that the output before and after the CLOB is updated is definitely different; there is extraneous information following the XML document - I just don't understand why this happens.


[Fatal Error] :23:10: Content is not allowed in trailing section.
org.xml.sax.SAXParseException: Content is not allowed in trailing section.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.embMessageProcessor.processMsgList(embMessageProcessor.java:91)
at com.embMessageProcessor.main(embMessageProcessor.java:28)
Press any key to continue...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 27 2007
Added on Nov 29 2006
3 comments
1,479 views