JDBCCallableStatementReaderPattern

このパターンは、ストアード・プロシージャーを使用して Java™ Database Connectivity (JDBC) 接続 からデータを処理するビジネス・ロジックの実装に使用されます。接続のオープンとクローズの管理用 タスクは、バッチ・フレームワークによって実行されます。

サポートされるクラス

  1. JDBCCallableStatementReader

    このクラスは、JDBC 入力ストリームの 使用パターンが照会から単一の結果を取得するときに参照されます。 この照会と結果は、そのステップの反復が終了するたびに破棄されます。 このクラスは、用意されたステートメントの代わりに呼び出し可能ステートメントを使用する点が JDBCReader とは異なります。

  2. LocalJDBCCallableStatementReader

    このクラスは、ローカル・データベースからデータが読み取られるときに参照されます。

必須プロパティー

以下は、このパターンの必須のプロパティーです。
表 1. 必須プロパティー. 次の表は、必須プロパティーのそれぞれ、 その値、JDBCCallableStatementReader クラスと LocalJDBCCallableStatementReader クラスの いずれが適用されるかを示しています。
プロパティー JDBCCallableStatementReader LocalJDBCCallableStatementReader
PATTERN_IMPL_CLASS JDBCCallableStatementReaderPattern インターフェースを実装する クラス。 該当あり 該当あり
ds_jndi_name データ・ソースの JNDI 名。 該当あり 該当あり
jdbc_url JDBC の URL。例えば、jdbc:derby:C:¥¥mysample¥¥CREDITREPORT です。 該当なし 該当あり
jdbc_driver JDBC ドライバー。例えば、org.apache.derby.jdbc.EmbeddedDriver です。 該当なし 該当あり
userid データベースのユーザー ID。 該当なし 該当あり
pswd ユーザー・パスワード。 該当なし 該当あり

オプション・プロパティー

以下は、このパターンのオプションのプロパティーです。
表 2. オプション・プロパティー. 次の表は、オプション・プロパティーのそれぞれ、 その値と説明、JDBCCallableStatementReader クラスと LocalJDBCCallableStatementReader クラスの いずれが適用されるかを示しています。
プロパティー名 説明 JDBCCallableStatementReader LocalJDBCCallableStatementReader
CursorHoldabilityEnabled true または false (デフォルトは false) この BDS リーダーのカーソル保持機能を有効にします。 該当あり 該当あり
debug true または false。 デフォルト値は false です。 このバッチ・データ・ストリームに対する詳細トレースを使用可能にします。 該当あり 該当あり
EnablePerformanceMeasurement true または false。 デフォルト値は false です。 GenericXDBatchStep を使用している場合に、バッチ・データ・ストリームおよび processRecord メソッドに費やされた合計時間を計算します。 該当あり 該当あり
EnableDetailedPerformanceMeasurement true または false。 デフォルト値は false です。 バッチ・データ・ストリームの各メソッドで費やされた時間のより詳細な明細を提供します。 該当あり 該当あり

インターフェース定義

public interface JDBCCallableStatementReaderPattern {

		 /**
		  	 * This method is invoked during the job setup phase.
		  * 
		  	 * @param props properties provided in the xJCL 
		  */
		 
		 	public void initialize(Properties props);
		 
		 /**
	 	 * This method should retrieve values for the various columns for the current row from
	 	 * the given resultset object. Typically this data would be used to populate an
	 	 * intermediate object which would be returned
	 * @param resultSet
	 * @return
	 */
		 	public Object fetchRecord(ResultSet resultSet);
		 
		 /**
	 	 * This method should return a ResultSet used by the stream to retrieve all relevant
	 	 * data that would be processed part of the job steps.
	 */
		public ResultSet getResultSet(CallableStatement cstmt) throws SQLException ;

	/**
	 	 * This method should return a Callable statement that will be used during setup of the
	 	 * stream to retrieve all relevant data that would be processed as part of the job steps.
	 	 * @return object to be used during process step.
	 */
		public CallableStatement getInitialCallableStatement(Connection con);
	
	/**
	 	 * This method gets called during Job Restart. The restart token should be used to create
	 	 * a Callable Statement that will retrieve previously unprocessed records. 
	 	 * Typically the restart token would be the primary key in the table and the query would
	 	 * get all rows with primary key value > restarttoken
	 * @param restartToken
	 	 * @return The restart query
	 */
		public CallableStatement getRestartCallableStatement(Connection con,String restartToken);
	
	/**
	 	 * This method gets called just before a checkpoint is taken.
	 	 * @return The method should return a string value identifying the last record read by the stream.
	 */
	public  String getRestartTokens();
		 		 
}

JDBCCallableStatementReader xJCL の例

<batch-data-streams>
<bds>
<logical-name>inputStream</logical-name>
<props>
<prop name="IMPLCLASS" value="com.ibm.websphere.batch.samples.tests.bds.EchoReader"/>
<prop name="ds_jndi_name" value="jdbc/echojndi"/>
<prop name="debug" value="false"/>
<prop name="EnablePerformanceMeasurement" value="true"/> 
</props>
<impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.JDBCCallableStatementReader</impl-class>
</bds>
</batch-data-streams>

トピックのタイプを示すアイコン 参照トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=rgrid_btchpttrnjdcsread
ファイル名:rgrid_btchpttrnjdcsread.html