background image
<< XML data type | Argument matching >>

JDBC metadata type

<< XML data type | Argument matching >>
Derby Reference Manual
205
or character streams by explicitly specifying the appropriate XML operators, XMLPARSE
and XMLSERIALIZE, as part of your SQL queries.
Syntax
XML
Corresponding compile-time Java type
None
The Java type for XML values is java.sql.SQLXML. However, the java.sql.SQLXML type
is not supported by Derby.
JDBC metadata type (java.sql.Types)
None
The metadata type for XML values is SQLXML. However, the SQLXML type is not
supported by Derby.
To retrieve XML values from a Derby database using JDBC, use the XMLSERIALIZE
operator in the SQL query. For example:
SELECT XMLSERIALIZE (xcol as CLOB) FROM myXmlTable
Then retrieve the XML value by using the getXXX method that corresponds to the target
serialization type, in this example CLOB data types.
To store an XML value into a Derby database using JDBC, use the XMLPARSE operator
in the SQL statement. For example:
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.