4.5.8 DB Connectorの環境設定

リソースアダプタであるDB Connectorの環境設定について説明します。DB Connectorの環境設定には,Cosminexusのサーバ管理コマンドを使用します。サーバ管理コマンドの操作方法については,マニュアル「Cosminexus アプリケーション設定操作ガイド」を参照してください。コマンドおよび属性ファイルの詳細については,マニュアル「Cosminexus リファレンス コマンド編」,およびマニュアル「Cosminexus リファレンス 定義編」を参照してください。

なお,使用するDB Connectorは,データベース接続に使用するドライバの種類によって異なります。使用するDB Connectorとそれぞれの参照先を次の表に示します。

表4-9 使用するDB Connectorと参照先

OSデータベース接続に使用するドライバ使用するDB Connector参照先
WindowsCosminexus DABroker LibraryDBConnector_DABJ_CP.rar4.5.8(1)
HiRDB Type4 JDBC DriverDBConnector_HiRDB_Type4_CP.rar4.5.8(2)
UNIXHiRDB Type4 JDBC DriverDBConnector_HiRDB_Type4_CP.rar4.5.8(2)
<この項の構成>
(1) データベース接続にCosminexus DABroker Libraryを使用する場合
(2) データベース接続にHiRDB Type4 JDBC Driverを使用する場合

(1) データベース接続にCosminexus DABroker Libraryを使用する場合

データベース接続にCosminexus DABroker Libraryを使用する場合の,DB Connectorの環境設定の方法について説明します。

(a) DB Connectorの環境設定の手順

DB Connectorの環境設定の手順を次に示します。

  1. DB Connectorをインポートします。
    リソースのインポートコマンド(cjimportres)を実行し,次のファイルをインポートしてください。
    <Cosminexusのインストールディレクトリ>¥CC¥DBConnector¥DBConnector_DABJ_CP.rar
    【例】
    J2EEサーバ"mssl"に,DB Connectorをインポートする場合の実行例を次に示します。

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjimportres mssl -type rar -f "C:¥Program Files¥Hitachi¥Cosminexus¥CC¥DBConnector¥DBConnector_DABJ_CP.rar"

  2. インポートしたDB Connectorの表示名を確認します。
    DB Connectorをインポートすると,DB Connectorの表示名(resname)が自動的に設定されます。DB Connectorのプロパティを定義したり,DB Connectorを開始・停止したりする場合には,この表示名を使用してDB Connectorを指定する必要があります。このため,リソースの一覧表示コマンド(cjlistres)を実行し,DB Connectorの表示名を確認してください。
    【例】
    J2EEサーバ"mssl"にインポートしたDB Connectorの表示名を確認する場合の実行例を次に示します。

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjlistres mssl -type rar
    KDJE37400-I Connecting to mssl...
    DB_Connector_for_Cosminexus_Driver
    KDJE37508-I All rars have been listed successfully. (number = [1])

    実行例中の"DB_Connector_for_Cosminexus_Driver"がDB Connectorの表示名です。
  3. DB Connectorの属性ファイル(Connector属性ファイル)を取得します。
    DB Connectorのプロパティを定義するために,リソースの属性取得コマンド(cjgetresprop)を実行し,DB ConnectorのConnector属性ファイルを取得してください。
    【例】
    J2EEサーバ"mssl"のDB Connectorである"DB_Connector_for_Cosminexus_Driver"のConnector属性ファイルを取得する場合の実行例を次に示します。なお,この例では,属性ファイルのパスに"C:¥prop¥DBConnector_Prop.xml"を指定しています。

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjgetresprop mssl -type rar -resname DB_Connector_for_Cosminexus_Driver -c C:¥prop¥DBConnector_Prop.xml

  4. Connector属性ファイルを編集し,DB Connectorのプロパティを定義します。
    取得したConnector属性ファイルをテキストエディタで編集し,プロパティを定義してください。プロパティの定義内容については,「4.5.8(1)(b) DB Connectorのプロパティ定義」を参照してください。
  5. Connector属性ファイルに定義したプロパティを,DB Connectorに設定します。
    リソースの属性設定コマンド(cjsetresprop)を実行し,Connector属性ファイルに定義したプロパティをDB Connectorに反映させてください。
    【例】
    J2EEサーバ"mssl"のDB Connectorである"DB_Connector_for_Cosminexus_Driver"にプロパティを反映させる場合の実行例を次に示します。

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjsetresprop mssl -type rar -resname DB_Connector_for_Cosminexus_Driver -c C:¥prop¥DBConnector_Prop.xml

  6. プロパティを定義したDB ConnectorをJ2EEサーバにデプロイします。
    リソースアダプタのデプロイコマンド(cjdeployrar)を実行し,DB ConnectorをJ2EEサーバにデプロイしてください。
    【例】
    J2EEサーバ"mssl"にDB Connectorである"DB_Connector_for_Cosminexus_Driver"をデプロイする場合の実行例を次に示します。

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjdeployrar mssl -resname DB_Connector_for_Cosminexus_Driver

  7. 接続テストを実施して,DB Connectorに設定した内容が正しいかどうかを検証します。
    リソースの接続テストコマンド(cjtestres)を実行し,接続テストを実施してください。
    【例】
    J2EEサーバ"mssl"のDB Connectorである"DB_Connector_for_Cosminexus_Driver"の接続テストを実施する場合の実行例を次に示します。

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjtestres mssl -type rar -resname DB_Connector_for_Cosminexus_Driver

  8. DB Connectorを開始します。
    リソースアダプタの開始コマンド(cjstartrar)を実行し,DB Connectorを正しく開始できるか確認してください。
    【例】
    J2EEサーバ"mssl"のDB Connectorである"DB_Connector_for_Cosminexus_Driver"を開始する場合の実行例を次に示します。

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjstartrar mssl -resname DB_Connector_for_Cosminexus_Driver

(b) DB Connectorのプロパティ定義

取得したConnector属性ファイルをテキストエディタで編集し,プロパティを定義します。

CMS Lightサーバを使用する場合に設定する項目を次の表に示します。ほかの項目については,設定不要です。

表4-10 DB Connectorのプロパティの定義内容(Cosminexus DABroker Libraryを使用する場合)

項番項目対応するConnector属性ファイルのタグ設定内容
1Cosminexus DABroker Libraryとの接続種別<config-property>タグのnetworkProtocolプロパティの値として,"lib"を指定します。
2接続するデータベースの種別<config-property>タグのdatabaseNameプロパティの値として,"HIRDB"を指定します。
3接続するデータベースに必要な接続付加情報<config-property>タグのdescriptionプロパティの値として,"@DABENVGRP=HSRSDB"を指定します。
4エンコード文字形態<config-property>タグのencodLangプロパティの値として,エンコード文字形態を指定します。
5LONGVARBINARYのデータベースアクセス方法<config-property>タグのLONGVARBINARY_Accessプロパティの値として,"LOCATOR"を指定します。
6コネクションプールにプールするコネクションの最大値<property>タグのMaxPoolSizeプロパティの値として,「4.2.1 データベース接続数の計算」で見積もった,データベースへの最大接続数を指定します。
7コネクションプールにプールするコネクションの最小値<property>タグのMinPoolSizeプロパティの値として,「4.2.1 データベース接続数の計算」で見積もった,データベースへの最大接続数から5を引いた数を指定します。
8データベースに接続するユーザーのユーザーID<property>タグのUserプロパティの値として,「4.5.5(1)(a) データベース接続にCosminexus DABroker Libraryを使用する場合」のPDUSER設定で指定したユーザーIDを指定します。
9データベースに接続するユーザーのパスワード<property>タグのPasswordプロパティの値として,「4.5.5(1)(a) データベース接続にCosminexus DABroker Libraryを使用する場合」のPDUSER設定で指定したパスワードを指定します。

Connector属性ファイルの各タグでの定義方法を次に示します。

【例】
CMS Lightサーバを使用する場合のConnector属性ファイルの定義例を次に示します。

      :
 <config-property>
   <description></description>
   <config-property-name>networkProtocol</config-property-name>
   <config-property-type>java.lang.String</config-property-type>
   <config-property-value>lib</config-property-value>
 </config-property>
      :
 <config-property>
   <description></description>
   <config-property-name>databaseName</config-property-name>
   <config-property-type>java.lang.String</config-property-type>
   <config-property-value>HIRDB</config-property-value>
 </config-property>
 <config-property>
   <description></description>
   <config-property-name>description</config-property-name>
   <config-property-type>java.lang.String</config-property-type>
   <config-property-value>@DABENVGRP=HSRSDB</config-property-value>
 </config-property>
      :
 <config-property>
   <description></description>
   <config-property-name>encodLang</config-property-name>
   <config-property-type>java.lang.String</config-property-type>
   <config-property-value>MS932</config-property-value>
 </config-property>
      :
 <property>
   <property-name>MaxPoolSize</property-name>
   <property-type>int</property-type>
   <property-value>10</property-value>
 </property>
 <property>
   <property-name>MinPoolSize</property-name>
   <property-type>int</property-type>
   <property-value>5</property-value>
 </property>
      :
 <property>
   <property-name>User</property-name>
   <property-type>String</property-type>
   <property-value>hsrsdb</property-value>
 </property>
 <property>
   <property-name>Password</property-name>
   <property-type>String</property-type>
   <property-value>pwhsrsdb</property-value>
 </property>
      :

(2) データベース接続にHiRDB Type4 JDBC Driverを使用する場合

データベース接続にHiRDB Type4 JDBC Driverを使用する場合の,DB Connectorの環境設定の方法について説明します。

(a) DB Connectorの環境設定の手順

DB Connectorの環境設定の手順を次に示します。

  1. DB Connectorをインポートします。
    リソースのインポートコマンド(cjimportres)を実行し,次のファイルをインポートしてください。
    • Windowsの場合
      <Cosminexus のインストールディレクトリ>¥CC¥DBConnector¥DBConnector_HiRDB_Type4_CP.rar
    • UNIXの場合
      /opt/Cosminexus/CC/DBConnector/DBConnector_HiRDB_Type4_CP.rar
    【例】
    J2EEサーバ"mssl"に,DB Connectorをインポートする場合の実行例を次に示します。
    Windowsの場合

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjimportres mssl -type rar -f "C:¥Program Files¥Hitachi¥Cosminexus¥CC¥DBConnector¥DBConnector_HiRDB_Type4_CP.rar"

    UNIXの場合

    # cd /opt/Cosminexus/CC/admin/bin
    # ./cjimportres mssl -type rar -f /opt/Cosminexus/CC/DBConnector/DBConnector_HiRDB_Type4_CP.rar

  2. インポートしたDB Connectorの表示名を確認します。
    DB Connectorをインポートすると,DB Connectorの表示名(resname)が自動的に設定されます。DB Connectorのプロパティを定義したり,DB Connectorを開始・停止したりする場合には,この表示名を使用してDB Connectorを指定する必要があります。このため,リソースの一覧表示コマンド(cjlistres)を実行し,DB Connectorの表示名を確認してください。
    【例】
    J2EEサーバ"mssl"にインポートしたDB Connectorの表示名を確認する場合の実行例を次に示します。実行例中の"DB_Connector_for_HiRDB_Type4"がDB Connectorの表示名です。
    Windowsの場合

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjlistres mssl -type rar
    KDJE37400-I Connecting to mssl...
    DB_Connector_for_HiRDB_Type4
    KDJE37508-I All rars have been listed successfully. (number = [1])

    UNIXの場合

    # cd /opt/Cosminexus/CC/admin/bin
    # ./cjlistres mssl -type rar
    KDJE37400-I Connecting to mssl...
    DB_Connector_for_HiRDB_Type4
    KDJE37508-I All rars have been listed successfully. (number = [1])

  3. DB Connectorの属性ファイル(Connector属性ファイル)を取得します。
    DB Connectorのプロパティを定義するために,リソースの属性取得コマンド(cjgetresprop)を実行し,DB ConnectorのConnector属性ファイルを取得してください。
    【例】
    J2EEサーバ"mssl"のDB Connectorである"DB_Connector_for_HiRDB_Type4"のConnector属性ファイルを取得する場合の実行例を次に示します。
    Windowsの場合
    ここでは,属性ファイルのパスに"C:¥prop¥DBConnector_Prop.xml"を指定しています。

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjgetresprop mssl -type rar -resname DB_Connector_for_HiRDB_Type4 -c C:¥prop¥DBConnector_Prop.xml

    UNIXの場合
    ここでは,属性ファイルのパスに"/prop/DBConnector_Prop.xml"を指定しています。

    # cd /opt/Cosminexus/CC/admin/bin
    # ./cjgetresprop mssl -type rar -resname DB_Connector_for_HiRDB_Type4 -c /prop/DBConnector_Prop.xml

  4. Connector属性ファイルを編集し,DB Connectorのプロパティを定義します。
    取得したConnector属性ファイルをテキストエディタで編集し,プロパティを定義してください。プロパティの定義内容については,「4.5.8(2)(b) DB Connectorのプロパティ定義」を参照してください。
  5. Connector属性ファイルに定義したプロパティを,DB Connectorに設定します。
    リソースの属性設定コマンド(cjsetresprop)を実行し,Connector属性ファイルに定義したプロパティをDB Connectorに反映させてください。
    【例】
    J2EEサーバ"mssl"のDB Connectorである"DB_Connector_for_HiRDB_Type4"にプロパティを反映させる場合の実行例を次に示します。
    Windowsの場合
    ここでは,属性ファイルのパスに"C:¥prop¥DBConnector_Prop.xml"を指定しています。

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjsetresprop mssl -type rar -resname DB_Connector_for_HiRDB_Type4 -c C:¥prop¥DBConnector_Prop.xml

    UNIXの場合
    ここでは,属性ファイルのパスに"/prop/DBConnector_Prop.xml"を指定しています。

    # cd /opt/Cosminexus/CC/admin/bin
    # ./cjsetresprop mssl -type rar -resname DB_Connector_for_HiRDB_Type4 -c /prop/DBConnector_Prop.xml

  6. プロパティを定義したDB ConnectorをJ2EEサーバにデプロイします。
    リソースアダプタのデプロイコマンド(cjdeployrar)を実行し,DB ConnectorをJ2EEサーバにデプロイしてください。
    【例】
    J2EEサーバ"mssl"にDB Connectorである"DB_Connector_for_HiRDB_Type4"をデプロイする場合の実行例を次に示します。
    Windowsの場合

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjdeployrar mssl -resname DB_Connector_for_HiRDB_Type4

    UNIXの場合

    # cd /opt/Cosminexus/CC/admin/bin
    # ./cjdeployrar mssl -resname DB_Connector_for_HiRDB_Type4

  7. 接続テストを実施して,DB Connectorに設定した内容が正しいかどうかを検証します。
    リソースの接続テストコマンド(cjtestres)を実行し,接続テストを実施してください。
    【例】
    J2EEサーバ"mssl"のDB Connectorである"DB_Connector_for_HiRDB_Type4"の接続テストを実施する場合の実行例を次に示します。
    Windowsの場合

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjtestres mssl -type rar -resname DB_Connector_for_HiRDB_Type4

    UNIXの場合

    # cd /opt/Cosminexus/CC/admin/bin
    # ./cjtestres mssl -type rar -resname DB_Connector_for_HiRDB_Type4

  8. DB Connectorを開始します。
    リソースアダプタの開始コマンド(cjstartrar)を実行し,DB Connectorを正しく開始できるか確認してください。
    【例】
    J2EEサーバ"mssl"のDB Connectorである"DB_Connector_for_HiRDB_Type4"を開始する場合の実行例を次に示します。
    Windowsの場合

    C:¥>cd C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin
    C:¥Program Files¥Hitachi¥Cosminexus¥CC¥admin¥bin>cjstartrar mssl -resname DB_Connector_for_HiRDB_Type4

    UNIXの場合

    # cd /opt/Cosminexus/CC/admin/bin
    # ./cjstartrar mssl -resname DB_Connector_for_HiRDB_Type4

(b) DB Connectorのプロパティ定義

取得したConnector属性ファイルをテキストエディタで編集し,プロパティを定義します。

CMS Lightサーバを使用する場合に設定する項目を次の表に示します。ほかの項目については,設定不要です。

表4-11 DB Connectorのプロパティの定義内容(HiRDB Type4 JDBC Driverを使用する場合)

項番項目対応するConnector属性ファイルのタグ設定内容
1接続するデータベースに必要な接続付加情報<config-property>タグのdescriptionプロパティの値として,"@HIRDBENVGRP=<HiRDB.iniファイルのパス>"を指定します。
<HiRDB.iniファイルのパス>には,「4.5.5 HiRDBのクライアント環境変数の設定」で作成したHiRDB.iniファイルのパスを指定してください。半角スペースを含むパスを指定するときは,パス全体を""(ダブルクォーテーション)で囲む必要があります。
2データ変換時の文字セット名称<config-property>タグのencodeLangプロパティの値として,接続先のHiRDBの文字コードに対応する変換文字セットを指定します。
3LONGVARBINARYのデータベースアクセス方法<config-property>タグのLONGVARBINARY_Accessプロパティの値として,"LOCATOR"を指定します。
4コネクションプールにプールするコネクションの最大値<property>タグのMaxPoolSizeプロパティの値として,「4.2.1 データベース接続数の計算」で見積もった,データベースへの最大接続数を指定します。
5コネクションプールにプールするコネクションの最小値<property>タグのMinPoolSizeプロパティの値として,「4.2.1 データベース接続数の計算」で見積もった,データベースへの最大接続数から5を引いた数を指定します。
6データベースに接続するユーザーのユーザーID<property>タグのUserプロパティの値として,「4.5.5 HiRDBのクライアント環境変数の設定」のPDUSERで指定したユーザーIDを指定します。
7データベースに接続するユーザーのパスワード<property>タグのPasswordプロパティの値として,「4.5.5 HiRDBのクライアント環境変数の設定」のPDUSERで指定したパスワードを指定します。

Connector属性ファイルの各タグでの定義方法を次に示します。

【例】
CMS Lightサーバを使用する場合のConnector属性ファイルの定義例を次に示します。
  • Windowsの場合

          :
     <config-property>
       <description xml:lang="en"></description>
       <config-property-name>description</config-property-name>
       <config-property-type>java.lang.String</config-property-type>
       <config-property-value>@HIRDBENVGRP="C:¥Program Files¥Hitachi¥ebxml¥mssl¥conf¥HiRDB.ini"</config-property-value>
     </config-property>
          :
     <config-property>
       <description xml:lang="en"></description>
       <config-property-name>encodeLang</config-property-name>
       <config-property-type>java.lang.String</config-property-type>
       <config-property-value>MS932</config-property-value>
     </config-property>
          :
     <config-property>
       <description xml:lang="en"></description>
       <config-property-name>LONGVARBINARY_Access</config-property-name>
       <config-property-type>java.lang.String</config-property-type>
       <config-property-value>LOCATOR</config-property-value>
     </config-property>
          :
     <property>
       <property-name>MaxPoolSize</property-name>
       <property-type>int</property-type>
       <property-value>10</property-value>
       <property-default-value>10</property-default-value>
     </property>
     <property>
       <property-name>MinPoolSize</property-name>
       <property-type>int</property-type>
       <property-value>5</property-value>
       <property-default-value>10</property-default-value>
     </property>
          :
     <property>
       <property-name>User</property-name>
       <property-type>String</property-type>
       <property-value>hsrsdb</property-value>
     </property>
     <property>
       <property-name>Password</property-name>
       <property-type>String</property-type>
       <property-value>pwhsrsdb</property-value>
     </property>
          :

  • UNIXの場合

          :
     <config-property>
       <description xml:lang="en"></description>
       <config-property-name>description</config-property-name>
       <config-property-type>java.lang.String</config-property-type>
       <config-property-value>@HIRDBENVGRP=/opt/ebxml/mssl/conf/HiRDB.ini</config-property-value>
     </config-property>
          :
     <config-property>
       <description xml:lang="en"></description>
       <config-property-name>encodeLang</config-property-name>
       <config-property-type>java.lang.String</config-property-type>
       <config-property-value>MS932</config-property-value>
     </config-property>
          :
     <config-property>
       <description xml:lang="en"></description>
       <config-property-name>LONGVARBINARY_Access</config-property-name>
       <config-property-type>java.lang.String</config-property-type>
       <config-property-value>LOCATOR</config-property-value>
     </config-property>
          :
     <property>
       <property-name>MaxPoolSize</property-name>
       <property-type>int</property-type>
       <property-value>10</property-value>
       <property-default-value>10</property-default-value>
     </property>
     <property>
       <property-name>MinPoolSize</property-name>
       <property-type>int</property-type>
       <property-value>5</property-value>
       <property-default-value>10</property-default-value>
     </property>
          :
     <property>
       <property-name>User</property-name>
       <property-type>String</property-type>
       <property-value>hsrsdb</property-value>
     </property>
     <property>
       <property-name>Password</property-name>
       <property-type>String</property-type>
       <property-value>pwhsrsdb</property-value>
     </property>
          :