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.

Supporting 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.

Table 1. Required properties . The table includes the name and value of each required property for the pattern.
Property name Value
PATTERN_IMPL_CLASS Class implementing PureQueryWriterPattern interface
PQ_DATA_BEAN_INTERFACE PureQuery data bean interface
ds_jndi_name Java™ Naming and Directory Interface (JNDI) name of the data source to access the database

Optional properties

The following properties are optional for the pattern.

Table 2. Optional properties . The table includes the name, value, and description of each optional property for the pattern.
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 you can use to define a batch data stream which implements the PureQueryWriterPattern interface in your 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>