Java Reference
In-Depth Information
WebRowSet rowSet = new WebRowSet();
//set url,login and password;
rowSet.setUrl( url );
rowSet.setUsername( login );
rowSet.setPassword( password );
//set the sql command
rowSet.setCommand("Itemise_Fees 10001;");
//execute the command
rowSet.execute();
// write the RowSet as XML
FileWriter xmlFileWriter = new FileWriter("fees.xml");
rowSet.writeXml(xmlFileWriter);
//close the RowSet
rowSet.close();
} catch(Exception e) {
System.err.println(e.getMessage());
}
}
}
Listing 18-11 shows the format of the XML generated by the WebRowSet . Since the WebRowSet is
actually serialized in XML format, it contains not only the row data but all the associated metadata
required to reconstruct the RowSet in its entirety.
Listing 18-11: XML generated by WebRowSet
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE RowSet PUBLIC '-//Sun Microsystems, Inc.//DTD RowSet//EN'
'http://java.sun.com/j2ee/dtds/RowSet.dtd'>
<RowSet>
<properties>
<command>Itemise_Fees 10001;</command>
<concurrency>1008</concurrency>
<datasource><null/></datasource>
<escape-processing>true</escape-processing>
<fetch-direction>0</fetch-direction>
<fetch-size>0</fetch-size>
Search WWH ::




Custom Search