PureQueryWriterPattern
Use this pattern to write data to 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 PureQueryWriter class implements the basic operations of opening and closing database connections, obtaining the PureQuery data interface, and batching operations.
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 PureQueryWriterPattern 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 force_connection_recycle false Forces the connection to be closed and reopened during checkpoint processing Batch_interval 20 Number of operations to batch
Interface definition
The PureQueryWriterPattern Interface definition shows the methods that you must implement to support the PureQueryWriterPattern interface.
public interface PureQueryWriterPattern { public void initialize(Properties props); /** * The parent class passes the record to be written, the data interface, or the data interface * user method in order to update the database. The application might use the data interface to * run the pureQuery API method for in-line style or the data interface method for annotation style. * The parent class passes the record to be written and the * Data interface that may be used by the application to execute the pureQuery API method * (for in-line style ) or the Data interface user method ( for annotation style ) in order * to update the database. * @param * @param record * @return */ public void writeRecord(Data dataInterface, Object record); }
xJCL example
The example shows xJCL that we can use to define a batch data stream which implements the PureQueryWriterPattern interface in the application.
<batch-data-streams> <bds> <logical-name>outputStream</logical-name> <props> <prop name="PATTERN-IMPL-CLASS" value="com.ibm.MyWriterPattern"/> <prop name="jdbc_url" value="jdbc:derby:C:\\mysample\\CREDITREPORT"/> <prop name="jdbc_driver" value="org.apache.derby.jdbc.EmbeddedDriver"/> <prop name="user_id" value="myid"/> <prop name="pswd" value="mypwd"/> <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.PureQueryWriter</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 PureQueryReaderPattern (zos) RecordOrientedDatasetReaderPattern
(zos) RecordOrientedDataSetWriterPattern