Search code examples
xmlhsqldb

How to save XML Data in String form in HSQLDB table column


I have a webservice client which calls Webservice-A for xml data in string form. The client receives the xml data in string. The thread needs to push the same xml data in string form to another Webservice-B. What we need is to save this xml data in hsqldb table column before pushing it to Webservice-B via thread. I checked the supported data types of HSQLDB which includes XML but when i set the datatype of column as XML, the table cannot be created. Please guide.


Solution

  • You create the table with a LONGVARCHAR or CLOB column and store the XML data there.

    For your usage you just use the setString() method of PreparedStatement and getString() method of RasultSet to insert and retrieve the XML.

    Only if you need to access the fields or create the XML data, you use the getSQLXML() method of ResultSet and createSQLXML() method of Connection.