WebRowSet and columns of type boolean with HSQLDB
Hi,
I try to share relational data stored in HSQLDB within a p2p network via apache axis 2 web services. I use WebRowSets to store the results and convert them to xml and vice versa. It works fine until I try to use columns of type Boolean. Does anyone know how to use columns of type Boolean with WebRowSets or is there another possibility to serialize ResultSets instead of WebRowSets and xml?
Columns of type Boolean or a must due the fact that the system tables or stored in INFORMATION_SCHEMA.SYSTEM_TABLES with column READ_ONLY of type Boolean and I need to share these data too to get the database metadata.
Thanks a lot!
Michael
Here is some sample code to reproduce my issue:
// Load the HSQL Database Engine JDBC driver // hsqldb.jar should be in the class path or made part of the current jar Class.forName("org.hsqldb.jdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:hsqldb:file:test_db",
"sa", // username
"");
WebRowSetImpl webRS = new WebRowSetImpl(); StringWriter sw = new StringWriter(); webRS.setCommand( "SELECT * FROM sample_table" ); webRS.execute(conn); webRS.writeXml(sw);
// Create another WebRowSet
WebRowSetImpl webRS2 = new WebRowSetImpl();
// convert xml to a WebRowSet
webRS2.readXml(new StringReader(sw.toString()));
Until my sample table looks like this
CREATE MEMORY TABLE SAMPLE_TABLE2(KEY CHAR(1),VALUE CHAR(1)) INSERT INTO SAMPLE_TABLE VALUES('F','F')
everything is fine. If I change the definition to
CREATE MEMORY TABLE SAMPLE_TABLE(KEY BOOLEAN,VALUE CHAR(1)) INSERT INTO SAMPLE_TABLE VALUES(false,'F')
I get the following exception:
org.xml.sax.SAXException: Error constructing insert row : {0}Data Type Mismatch16
at com.sun.rowset.internal.XmlReaderContentHandler.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.rowset.internal.WebRowSetXmlReader.readXML(Unknown Source)
at com.sun.rowset.WebRowSetImpl.readXml(Unknown Source)
at jdbcTest.Minimal.main(Minimal.java:71)
Exception in thread "main" java.sql.SQLException: Error constructing insert row : {0}Data Type Mismatch16
at com.sun.rowset.WebRowSetImpl.readXml(Unknown Source)
at jdbcTest.Minimal.main(Minimal.java:71)