This pattern is used to implement the business logic of outputting data to a Java Database Connectivity (JDBC) connection using a stored procedure. The administrative tasks of opening and closing the connection are done by the batch framework.
This class is referenced when the usage pattern of your JDBC input stream retrieves a single result from a query. The query and results are discarded after every iteration of the step. This class differs from JBDCWriter in that it uses a callable statement instead of a prepared statement.
This class is referenced when data is read from a local database.
Property | Value | JDBCCallableStatementWriter | LocalJDBCCallableStatementWriter |
---|---|---|---|
PATTERN_IMPL_CLASS | The class implementing the JDBCCallableStatementReaderPattern interface | Applicable | Applicable |
ds_jndi_name | The data source JNDI name. | Applicable | Applicable |
jdbc_url | The JDBC URL. For example, jdbc:derby:C:\\mysample\\CREDITREPORT. | Not applicable | Applicable |
jdbc_driver | The JDBC driver. For example, org.apache.derby.jdbc.EmbeddedDriver | Not applicable | Applicable |
userid | The user ID for the database. | Not applicable | Applicable |
pswd | The user password. | Not applicable | Applicable |
Property name | Value | Description | JDBCCallableStatementWriter | LocalJDBCCallableStatementWriter |
---|---|---|---|---|
debug | true or false. The default value is false. | Enables detailed tracing on this batch data stream. | 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 |
EnablePerformanceMeasurement | true or false. The default value 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. The default value is false. | Provides a more detailed breakdown of time spent in each method of the batch data streams. | Applicable | Applicable |
public interface JDBCCallableStatementWriterPattern { /** * This method is invoked during the job setup phase. * * @param props properties provided in the xJCL */ public void initialize(Properties props); /** * This is typically an Update query used to write data into the database * @return */ public String getCallableStatementSQL(); /** * The parent class BDSCallableStatementJDBCWriter creates a new CallableStatement and * passes it to this method. This method populates the CallableStatement * with appropriate values and returns it to the parent class for execution * @param pstmt * @param record * @return */ public CallableStatement writeRecord(CallableStatement pstmt, Object record); }
<batch-data-streams> <bds> <logical-name>outputStream</logical-name> <props> <prop name="IMPLCLASS" value="com.ibm.websphere.batch.samples.tests.bds.EchoWriter"/> <prop name="ds_jndi_name" value="jdbc/IVTdbxa"/> <prop name="batch_interval" value="2"/> <prop name="EnablePerformanceMeasurement" value="true"/> <prop name="debug" value="false"/> </props> <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.JDBCCallableStatementWriter</impl-class> </bds> </batch-data-streams>