sqlQuery
Make SQL Query on RDBMS and return XMLized result set.
Index > Books > Declarative Development Guide > Reference Library > Accessor Listing > sqlQuery

Rate this page:
Really useful
Satisfactory
Not helpful
Confusing
Incorrect
Unsure
Extra comments:


Module

urn:org:ten60:netkernel:mod:db

Definition

Active URI Base

active:sqlQuery

Format

<instr>
  <type>sqlQuery</type>
  <operand>
    <sql>SELECT * FROM table;</sql>
  </operand>
  <configuration>/myconfiguration/configRDBMS.xml</configuration>
  <target>var:resultsetDocument</target>
</instr>

Syntax

ArgumentRulesDescription
typeMandatory sqlQuery
operandMandatory the <sql> query document
configurationOptional optional configuration document
targetMandatory Fragment OKan XMLized results set document

The sqlQuery accessor performs an SQL query on an RDBMS using a JDBC connection. The query is provided in the operand as a canonical <sql> document (see example above). The result set is automatically converted into an XML document with root node <results>. Each row of the result set is a first child element <row>. Each column value will be returned as an element with a text value of the result. It is important that the column names returned in the result set are valid XML element names.

If there are no results a canonical null document is returned.

Like the underlying JDBC interface, sqlQuery cannot be used to update a document, use sqlUpdate or sqlBatch.

Configuration

By default the configuration will be read from ffpcl:/etc/ConfigRDBMS.xml. The document provides a driver and connection URI (see example below). Alternatively,the configuration can be provided in an optional <configuration> argument - this may be either a URI to a config document or a literal configuration document.

<config>  <rdbms>
    <jdbcDriver>com.mysql.jdbc.Driver</jdbcDriver>
    <jdbcConnection> jdbc:mysql://localhost/mydatabase?user=myusername&amp;password=mypassword </jdbcConnection>
  </rdbms>
</config>
© 2003-2005, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.