10.02.2013 Views

Progress Sonic ESB Configuration and Management Guide

Progress Sonic ESB Configuration and Management Guide

Progress Sonic ESB Configuration and Management Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 6: Driver Connection Properties <strong>and</strong> Data Types by Database Br<strong>and</strong><br />

XMLType Data Type<br />

The Oracle driver supports tables containing columns specified as XMLType for Oracle9i<br />

<strong>and</strong> higher. The driver maps the Oracle XMLType data type to the JDBC CLOB data type.<br />

XMLType columns can be used in queries just like any other column type. The data from<br />

XMLType columns can be retrieved as a String, Clob, CharacterStream, or AsciiStream.<br />

When inserting or updating XMLType columns, the data to be inserted or updated must be<br />

in the form of an XMLType data type.<br />

Oracle provides the xmltype() function to construct an XMLType data object. The xmlData<br />

argument of the xmltype() function can be specified as a string literal or a parameter<br />

marker. If a parameter marker is used, the parameter value may be set using the setString,<br />

setClob, setCharacterStream, or setAsciiStream methods.<br />

The following code inserts data into an XMLType column using a statement with a string<br />

literal as the xmlData argument of the xmltype() function:<br />

// Insert xml data as a literal<br />

String sql = "insert into XMLTypeTbl values (1, xmltype('" +<br />

"123Mark'))";<br />

Statement stmt = con.createStatement();<br />

stmt.executeUpdate(sql);<br />

The following code inserts data into an XMLType column using a prepared statement:<br />

// Insert xml data as a String parameter<br />

String xmlStr = "234Trish";<br />

String sql = "insert into XMLTypeTbl values (?, xmltype(?))";<br />

PreparedStatement prepStmt = con.prepareStatement(sql);<br />

prepStmt.setInt(1, 2);<br />

prepStmt.setString(2, xmlStr);<br />

prepStmt.executeUpdate();<br />

When the data from an XMLType column is retrieved as a Clob, the XMLType data cannot be<br />

updated using the Clob object. Calling the setString, setCharacterStream, or<br />

setAsciiStream methods of a Clob object returned from an XMLType column generates an<br />

SQLException.<br />

189 <strong>Progress</strong> <strong>Sonic</strong> <strong>ESB</strong> <strong>Configuration</strong> <strong>and</strong> <strong>Management</strong> <strong>Guide</strong> 8.5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!