Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
OracleWebRowSet cannot be cast to CachedRowSetImpl when calling acceptChanges()

Tried using OracleWebRowset to export and import ResultSet objects.

refer "https://docs.oracle.com/cd/B28359_01/java.111/b31224/jcrowset.htm#BABCFJBE"

OracleWebRowSet rs = new OracleWebRowSet();
System.setProperty("javax.xml.parsers.SAXParserFactory","oracle.xml.jaxp.JXSAXParserFactory");
FileReader fReader = new FileReader("xmlfile.xml");
rs.readXml(fReader);
rs.acceptChanges();
rs.close();

This raises the error:

java.lang.ClassCastException: oracle.jdbc.rowset.OracleWebRowSet cannot be cast to com.sun.rowset.CachedRowSetImpl
    at com.sun.rowset.internal.CachedRowSetWriter.writeData(CachedRowSetWriter.java:275)
    at oracle.jdbc.rowset.OracleCachedRowSet.acceptChanges(OracleCachedRowSet.java:1776)

Tried casting the basic WebRowSetImpl() to no avail

the reason I couldn't use the basic WebRowSet is because oracle NVARCHAR2 columns poses issues while writing and reading XML, raised errors like "can't form insert statements" and "not a proper type"

is there any workaround?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I found a solution...

Seems that the rowset writer and reader are not set properly in the OracleCachedRowSet base class of OracleWebRowSet

So to fix the issue, include two lines of code before calling acceptchanges() method

rs.setReader(new OracleCachedRowSetReader());
rs.setWriter(new OracleCachedRowSetWriter());

So the fixed code would look like:

OracleWebRowSet rs = new OracleWebRowSet();
System.setProperty("javax.xml.parsers.SAXParserFactory","oracle.xml.jaxp.JXSAXParserFactory");
FileReader fReader = new FileReader("xmlfile.xml");
rs.readXml(fReader);
rs.setReader(new OracleCachedRowSetReader());
rs.setWriter(new OracleCachedRowSetWriter());
rs.acceptChanges();
rs.close();
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!