This pattern is used to write data to a database using a JDBC connection.
Property name | Value | LocalJDBCWriter | JDBCWriter |
---|---|---|---|
PATTERN_IMPL_CLASS | Class implementing JDBCWriterPattern interface | Applicable |
Applicable |
ds_jndi_name | Datasource JNDI name. | Applicable |
Not applicable |
jdbc_url | The JDBC URL. For example, jdbc:derby:C:\\mysample\\CREDITREPORT. | Applicable |
Not applicable |
jdbc_driver | The JDBC driver. For example, org.apache.derby.jdbc.EmbeddedDriver | Applicable |
Not applicable |
user_id | The user ID for the database. For example, Myid | Applicable |
Not applicable |
pswd | User password. For example, mypwd. LocalJDBCReader only. | Applicable |
Not applicable |
Property name | Value | Description | LocalJDBCReader | JDBCWriter |
---|---|---|---|---|
debug |
true or false (default is false) |
Enables detailed tracing on this batch datastream. |
Applicable |
Applicable |
EnablePerformanceMeasurement |
true or false (default is false) |
Calculates the total time spent in the batch data-streams and the processRecord method, if you are using the GenericXDBatchStep. |
Applicable |
Applicable |
EnableDetailedPerformanceMeasurement |
true or false (default is false) |
Provides a more detailed breakdown of time spent in each method of the batch data-streams. |
Applicable |
Applicable |
batch_interval |
Default value is 20. Make the value less than the checkpoint interval for record-based checkpointing. |
Denotes the number of SQL updates to batch before committing. |
Applicable |
Applicable |
public interface JDBCWriterPattern { public void initialize(Properties props); /** * This is typically an Update query used to write data into the DB * @return */ public String getSQLQuery(); /** * The parent class BDSJDBCWriter creates a new preparedstatement and * passes it to this method. This method populates the preparedstatement * with appropriate values and returns it to the parent class for execution * @param pstmt * @param record * @return */ public PreparedStatement writeRecord(PreparedStatement pstmt, Object record); }
<batch-data-streams> <bds> <logical-name>outputStream</logical-name> <props> <prop name="PATTERN_IMPL_CLASS" value="com.ibm.websphere.batch.samples.tests.bds.EchoWriter"/> <prop name="ds_jndi_name" value="jdbc/fvtdb"/> <prop name="debug" value="true"/> </props> <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.JDBCWriter</impl-class> </bds> </batch-data-streams>
<batch-data-streams> <bds> <logical-name>outputStream</logical-name> <props> <prop name="PATTERN_IMPL_CLASS" value="com.ibm.websphere.batch.samples.tests.bds.EchoWriter"/> <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="myuserid"/> <prop name="pswd" value="mypswd"/> <prop name="debug" value="true"/> </props> <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.LocalJDBCWriter</impl-class> </bds> </batch-data-streams>