IBM Streams 4.2
Query element
SPL standard and specialized toolkits > com.ibm.streams.db 2.0.0 > Connection specifications document for the Database Toolkit > Access specification element for the Database Toolkit > Query element
The <query> element specifies information that is used by a Database Toolkit ODBCEnrich or ODBCSource operator that uses the access specification to query a database and produce a result set.
The following example shows an abridged access specification that contains a query element.
<access_specification name="PersonRemainder">
<query query="SELECT id, fname, lname FROM personsrc"
isolation_level="READ_UNCOMMITTED" replays="0" />
.
.
.
</access_specification>
The <query> element has three attributes.
- query:
- The value of the query attribute is any valid SQL SELECT statement for the database that is specified in the connection specification of the associated operator. The columns of the result set of the SELECT statement must correspond to the column elements of the <native_schema> element of the <access_specification>. The SELECT statement can contain ODBC parameter markers; if so, the access specification must have a parameter element corresponding to each ODBC parameter marker. This attribute is required.
- isolation_level:
- The value of the isolation_level attribute specifies the isolation level at which the query is run. The values for this attribute are the ODBC isolation levels. This attribute is optional; if omitted, the query is run at level READ_UNCOMMITTED.
- Note: Some database systems do not support running queries at READ_UNCOMMITTED level. See your database system documentation to determine which query levels are supported.
- replays:
- The value of the replays attribute specifies the number of times an ODBCSource operator runs the query. This attribute is ignored by an ODBCEnrich operator. If the value is 0, the ODBCSource operator runs the query repeatedly until the application is canceled. This attribute is optional. If omitted, the query runs once.