WebSphere Extended Deployment Compute Grid, Version 6.1
             Operating Systems: AIX, HP-UX, Linux, Solaris, Windows, z/OS


JDBCWriterPattern

This pattern is used to write data to a database using a JDBC connection.

Supporting classes

  1. JDBCWriter
  2. LocalJDBCWriter

Required properties

Table 1. Required properties
Property 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

Optional properties

Table 2. Optional properties
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. This value should be less than the checkpoint interval for record-based checkpointing.

Denotes the number of SQL updates to batch before committing.

Applicable

Applicable

Interface definition

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);
}

xJCL example

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

xJCL example

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



Related concepts
[Version 6.1.0.3 and later] Batch data stream framework and patterns
Related tasks
[Version 6.1.0.3 and later] Using the batch data stream (BDS) framework
Related information
[Version 6.1.0.3 and later] JDBCReaderPattern
[Version 6.1.0.3 and later] ByteReaderPattern
[Version 6.1.0.3 and later] ByteWriterPattern
[Version 6.1.0.3 and later] FileReaderPattern
[Version 6.1.0.3 and later] FileWriterPattern
[Version 6.1.0.3 and later] RecordOrientedDatasetReaderPattern
[For z/OS operating system] [Version 6.1.0.3 and later] RecordOrientedDataSetWriterPattern
[Version 6.1.0.5 and later] JPAReaderPattern
[Version 6.1.0.5 and later] JPAWriterPattern
Reference topic    

Terms of Use | Feedback

Last updated: Oct 30, 2009 6:22:31 PM EDT
http://publib.boulder.ibm.com/infocenter/wxdinfo/v6r1/index.jsp?topic=/com.ibm.websphere.gridmgr.doc/info/scheduler/rbtchpttrn2.html