The XML data type is used for Extensible Markup Language (XML) documents.
Because none of the JDBC-side support for SQL/XML is implemented in Derby, it is not possible to bind directly into an XML value or to retrieve an XML value directly from a result set using JDBC. Instead, you must bind and retrieve the XML data as Java strings or character streams by explicitly specifying the appropriate XML operators, XMLPARSE and XMLSERIALIZE, as part of your SQL queries.
The Java type for XML values is java.sql.SQLXML. However, the java.sql.SQLXML type is not supported by Derby.
The metadata type for XML values is SQLXML. However, the SQLXML type is not supported by Derby.
SELECT XMLSERIALIZE (xcol as CLOB) FROM myXmlTableThen retrieve the XML value by using the getXXX method that corresponds to the target serialization type, in this example CLOB data types.
INSERT INTO myXmlTable(xcol) VALUES XMLPARSE( DOCUMENT CAST (? AS CLOB) PRESERVE WHITESPACE)Then use any of the setXXX methods that are compatible with String types, in this example use the PreparedStatement.setString or PreparedStatement.setCharacterStream method calls to bind the operator.