PureQueryReaderPattern
Use this pattern is used to read data from a database using IBM Optimâ„¢ pureQuery Runtime. The batch data stream (BDS) framework completes the administrative tasks of opening and closing connections.
Support classes
The PureQueryReader class implements the basic operations of opening and closing database connections and obtaining the IBM Optim pureQuery Runtime data.
Required properties
The following properties are required for the pattern.
properties. The table includes the name and value of
Property name Value PATTERN_IMPL_CLASS Class implementing PureQueryReaderPattern interface PQ_DATA_BEAN_INTERFACE PureQuery data bean interface ds_jndi_name JNDI name of the data source to access the database
Optional properties
The following properties are optional for the pattern.
properties. The table includes the name, value, and description
Property name Value Description debug true or false (The default is false.) Enables detailed tracing on this batch data stream DB_SCHEMA null Database schema name EnablePerformanceMeasurement true or false (The default is false.) Calculates the total time spent in the batch data-streams and the processRecord method, if you are using the GenericXDBatchStep
Interface definition
The PureQueryReaderPattern Interface definition shows the methods that you must implement to support the PureQueryReaderPattern interface.
public interface PureQueryReaderPattern { /** * This method is called by the batch container during step setup. The properties passed * in are the ones that you provide in the xJCL BDS level properties. * @param properties */ public void initialize(Properties properties); /** * Invoked by the container during each iteration of the batch loop. This code obtains * the next record using the given iterator object. * @param iterator * @return */ public Object fetchRecord(Iterator iterator); /** * Returns the iterator based on the passed data object used to iterate * over the records * @param data * @return */ public Iterator getInitialIterator(Data data); /** * Returns the iterator based on the passed data object repositioned based on the restart * token of restartToken. * @param data * @param s * @return */ public Iterator getRestartIterator(Data data, String restartToken); /** * Invoked before a checkpoint is taken to save the restart token used in case * of a restart * @return */ public String getRestartTokens(); }
xJCL example
The example shows xJCL that we can use to define a batch datastream which implements the PureQueryReaderPattern interface in the application.
<batch-data-streams> <bds> <logical-name>outputStream</logical-name> <props> <prop name="IMPLCLASS" value="com.ibm.MyWriterPattern"/> <prop name="ds_jndi_name" value="jdbc/crreport"/> <prop name="debug" value="true"/> <prop name="DB_SCHEMA" value="PQDS"/> <prop name="PQ_DATA_BEAN_INTERFACE" value="com.ibm.MyEmployeeData"/> </props> <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.PureQueryReader</impl-class> </bds></batch-data-streams>
Related concepts
Batch data stream framework and patterns
Related tasks
Use the batch data stream framework IBM Optim pureQuery Runtime
Related information:
JDBCReaderPattern JPAReaderPattern JPAWriterPattern ByteReaderPattern ByteWriterPattern FileReaderPattern FileWriterPattern PureQueryWriterPattern (zos) RecordOrientedDatasetReaderPattern
(zos) RecordOrientedDataSetWriterPattern