Statement: Direct SQL
Input
<any element name>
<statement resulttag="result element name" timezone="timezone" format="Data format">
<sql> SQL statement </sql>
</statement>
</any element name>
The following rules apply to each <statement/>
element:
The optional attribute
timezone
specifies a timezone according tojava.util.TimeZone
, e. g.GMT+2
, see http://docs.oracle.com/javase/1.5.0/docs/api/java/util/TimeZone.html.The optional attribute
format
specifies a date format according tojava.text.SimpleDateFormat
.It contains at least one
<sql/>
element with an SQL statement.
If you use characters within the SQL statement or for the values or data of the table columns that have a meaning in XML, mask the SQL statement with surrounding CDATA block, e.g. <![CDATA[ SELECT * FROM TABLE WHERE ID<1 ]]>
or <rowset><row><name><!CDATA[
XML character “<“ in CDATA element]]></name></row></rowset>
.
This ensures that the characters in the CDATA element are not interpreted as XML, but as data for the adapter.
<select>
<statement resulttag="result" timezone="UTC" format="dd.MM.yyyy">
<sql> <![CDATA[SELECT * FROM JMS_USERS]]> </sql>
</statement>
</select>
Output
If the SQL statement was executed successfully, the database connection element will output an XML document containing the query response as a string with the following structure:
<Data>
<result-element-name>
<Field1><!--value--></Field1>
<Fieldn><!--value--></Fieldn>
</result-element-name>
</Data>
For SELECT
statements used to access database tables with column names that do not represent a valid XML name, synthetic element names are created within the result XML document, in order to ensure that the XML document is well-formed.