JDBCCallableStatementWriterPattern
This pattern is used to implement the business logic of outputting data to a JDBC connection using a stored procedure. The administrative tasks of opening and closing the connection are done by the batch framework.
Support classes
- JDBCCallableStatementWriter
This class is referenced when the usage pattern of the 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.
- LocalJDBCCallableStatementWriter
This class is referenced when data is read from a local database.
Required properties
The following properties are required for the pattern.
properties. The table includes each required property, its value, and whether the LocalJDBCReader class, the CursorHoldableJDBCReader
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
Optional properties
The following properties are optional for the pattern.
properties. The table includes each optional property, its value and description, and whether theJDBCCallableStatementWriter
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
Interface definition
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); }
JDBCCallableStatementWriter xJCL example
<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>
Related concepts
Batch data stream framework and patterns
Related tasks
Use the batch data stream framework
Related information:
JDBCWriterPattern ByteReaderPattern ByteWriterPattern FileReaderPattern FileWriterPattern JPAReaderPattern JPAWriterPattern