PureQueryWriterPattern
使用此模式以将数据写入使用 IBM® Optim™ pureQuery Runtime 的数据库。批处理数据流 (BDS) 框架完成打开和关闭连接的管理任务。
支持类
PureQueryWriter 类实现打开和关闭数据库连接和获取 PureQuery 数据接口的基本操作以及批处理操作。
必需属性
以下属性对于该模式是必需的。
属性名称 | 值 |
---|---|
PATTERN_IMPL_CLASS | 实现 PureQueryWriterPattern 接口的类 |
PQ_DATA_BEAN_INTERFACE | PureQuery 数据 bean 接口 |
ds_jndi_name | 用于访问数据库的数据源的 Java™ 命名和目录接口 (JNDI) 名称 |
可选属性
以下属性对于该模式是可选的。
属性名称 | 值 | 描述 |
---|---|---|
debug | true 或 false(缺省值为 false。) | 在此批处理数据流上启用详细跟踪。 |
DB_SCHEMA | null | 数据库模式名称 |
EnablePerformanceMeasurement | true 或 false(缺省值为 false。) | 如果正使用 GenericXDBatchStep,那么计算批处理数据流和 processRecord 方法中所花的总时间 |
force_connection_recycle | false | 处理检查点期间强制关闭连接并重新打开 |
Batch_interval | 20 | 要进行批处理的操作数 |
接口定义
PureQueryWriterPattern 接口定义显示您必须实现以支持 PureQueryWriterPattern 接口的方法。
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 示例
该示例显示 xJCL,可将此 xJCL 用于定义在应用程序中实现 PureQueryWriterPattern 接口的批处理数据流。
<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>