WebSphere Application Server - Express, Version 6.1   
             オペレーティング・システム: AIX , HP-UX, Linux, Solaris, Windows, Windows Vista

             目次と検索結果のパーソナライズ化

例: データベース接続のための IBM 拡張 API の使用

WSDataSource 拡張 API を使用して、接続を取得する前に、JDBC アプリケーションをコード化し、オブジェクトを介して接続プロパ ティーを定義することができます。この性質により、アプリケーションが CMP などの別のコンポ ーネントと接続を共用する可能性が高まります。

トランザクション内の他のコンテナー管理パーシスタンス (CMP) Bean と共用できる共用可能接続を用いて、アプリケーションを実行する場合、 WebSphere Application Server 拡張 API を使用して接続を取得するようにお勧めします。 この API を使用すると、 アプリケーションを他のアプリケーション・サーバーに移植できません。

JDBC アプリケーションで拡張 API を使用して直接コード化することができ ます。接続を取得するのに DataSource インターフェースを使用するのでは なく、WSDataSource インターフェースを使用してください。以下のコード・セグメントは WSDataSource を示しています。


import com.ibm.websphere.rsadapter.*;

... 

// Create a JDBCConnectionSpec and set connection properties. If this connection is shared with
the CMP bean, make sure that the isolation level is the same as the isolation level that is mapped by the Access Intent defined on the CMP bean.
JDBCConnectionSpec connSpec = WSRRAFactory.createJDBCConnectionSpec();

connSpec.setTransactionIsolation(CONNECTION.TRANSACTION_REPEATABLE_READ);

connSpec.setCatalog("DEPT407");


//Use WSDataSource to get the connection

Connection conn = ((WSDataSource)datasource).getConnection(connSpec);





関連概念
リソース・アダプター
共用不可能接続および共用可能接続
関連資料
データ・アクセス API に対する拡張機能
参照トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 6:25:35 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rdat_extiapi.html