# データベースのデータ取得

<div align="left"><figure><img src="/files/ejBZZeDrq5sOKCU38C1E" alt=""><figcaption></figcaption></figure></div>

以下の説明で使用されている画像は、PostgreSQL連携のイメージとなります。\
他のデータベース連携も同じ画面構成です。

## 機能概要

* **データベースのデータ取得**はデータベースからi-Reporterへ**i-Repo Gatewayを利用**して連携を行います。

<table><thead><tr><th>連携方向</th><th width="214.33333333333331">機能説明</th><th>実行タイミング</th></tr></thead><tbody><tr><td>データベース→i-Reporter連携</td><td>データベースのデータをi-Repo Gatewayを利用してi-Reporter入力帳票のクラスターへ取得します。</td><td>i-Reporterのアクションクラスターの実行</td></tr></tbody></table>

## マッピング設定の手順

以下の手順に従ってマッピング設定を行ってください。

### 1. データベースの連携パターンの選択

* **データベースのデータ取得**メニューをクリックして新規のマッピングを追加します。

<figure><img src="/files/Vc13hWFfbs4RxNdwRlec" alt=""><figcaption></figcaption></figure>

### 2. マッピングコード・名称の設定

* **マッピングコード**と**マッピング名称**を設定します。
* マッピングコードは、**i-Repo Link環境内の全てのマッピング設定を一意に識別するキー**になります。

<figure><img src="/files/I68RpEiGOgGWjd318IUA" alt=""><figcaption></figcaption></figure>

### 3. 連携元のデータベースのデータソースとテーブル／ビューの選択

* 連携元としてデータベースの**データソース**と**テーブルまたはビュー**を選択します。

<figure><img src="/files/LsghMyPnNZMT1y5UUZy8" alt=""><figcaption></figcaption></figure>

* データソースの追加・設定は、以下のページを参照してください。

{% content-ref url="/pages/Mr8iIh9WBLvgsGDHpX6I" %}
[データソース管理](/i-repo-link-manual/system/2/1.md)
{% endcontent-ref %}

### 4. 連携先のi-Reporter帳票定義の選択

<figure><img src="/files/EVwvtla6Fv1d5yz1hctV" alt=""><figcaption></figcaption></figure>

### 5. データベースのフィールドとi-Reporter帳票定義のクラスターをマッピング

* 画面[^1]左側にデータベース情報、画面右側にi-Reporterの帳票定義情報が表示されます。
* データベースのフィールドが薄いグレーのものは、連携対象外のフィールドです。
* マッピングできない場合は、エラーメッセージが表示されます。

<figure><img src="/files/TpocAGDfnqv7O7POcTC4" alt=""><figcaption></figcaption></figure>

* マッピングできるフィールドとクラスターの組み合わせは、以下のページを参照してください。

{% content-ref url="/pages/ovaom6EgjWaLTgbQ0bCv" %}
[PostgreSQLとi-Reporterの連携項目対応表](/i-repo-link-manual/dtassudtabsu/gong-tong/postgresqltoi-reporterno.md)
{% endcontent-ref %}

{% content-ref url="/pages/huPXfl98tMLvBivMq8Yg" %}
[Oracleとi-Reporterの連携項目対応表](/i-repo-link-manual/dtassudtabsu/gong-tong/oracletoi-reporterno.md)
{% endcontent-ref %}

{% content-ref url="/pages/4xMu2EwUob92vwSn4yZe" %}
[SQL Serverとi-Reporterの連携項目対応表](/i-repo-link-manual/dtassudtabsu/gong-tong/sql-servertoi-reporterno.md)
{% endcontent-ref %}

{% content-ref url="/pages/x5Td2nY0WNJrIqZMAp5u" %}
[MySQLとi-Reporterの連携項目対応表](/i-repo-link-manual/dtassudtabsu/gong-tong/mysqltoi-reporterno.md)
{% endcontent-ref %}

### 6. データ検索条件の設定

* データベースのデータを抽出するための検索条件を設定します。\
  検索されたデータを元に入力帳票のクラスターにi-Repo Gateway経由で値が設定されます。
* データベースのフィールドとi-Reporter帳票定義のクラスターを指定します。
* **レコードが１件となるように検索条件を設定**してください。\
  複数レコードが検索されると自動帳票作成はエラーとなります。

<figure><img src="/files/jeUy0Gm4fr4pT99oCDlv" alt=""><figcaption></figcaption></figure>

### 7. Gatewayの設定

* i-Repo Gatewayの**アクションファイルのダウンロードまたはGatewayサーバーへアクションファイルを配置**します。\
  Gatewayサーバーへアクションファイルを配置する場合は、**事前にシステム管理のi-RepoGateway設定**を行ってください。

{% content-ref url="/pages/j3pUvgktmFXnQz641Jhv" %}
[i-Repo Gateway設定/i-RepoLink Gateway設定](/i-repo-link-manual/system/2/3.md)
{% endcontent-ref %}

* 対象の帳票定義のアクションクラスターにGatewayのパラメーターを更新します。\
  **パラメーターの更新を行うと帳票定義のリビジョンがアップ**します。

<figure><img src="/files/2iQJbaZ5jj8QjxlpSQuX" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
**「【重要】 「Gatewayへ配置」ボタンを利用するために、i-Repo GatewayのConfigファイルの設定を変更ください**

i-Repo Gateway 2.1.230200 以降のバージョンを利用する必要があります。\
Gatewayへ配置を行うためには、i-Repo GatewayのConfigファイルの設定を変更してください。\
Configファイルのデフォルトインストール先：C:\ConMas\gateway\config\default.json\
Configファイルをメモ帳などで開き以下の末尾に記載した **runMode** の設定を「true」に変更してください。\
なお、default.json の修正を反映させる場合は、一度i-Repo Gatewayサービスの再起動が必要となります。\
※default.json に runMode の設定の記載がない場合、以下の末尾に記載した **runMode** の設定を追加してください。

**default.jsonファイル設定**

```json
{
  "port": 3000,
  "ssl": false,
  "sslkey": "./ssl/cert.key",
  "sslcert": "./ssl/cert.pem",
  "authType": "default",
  "token": "トークン",
  "pythonShell": {
    "mode": "text",
    "encoding": "utf8",
    "pythonOptions": ["-X", "utf8"]
  },
  "uploadFileTypes": {
    "binary": "bmp;gif;jpg;tif;png;wav",
    "text": ""
  },
  "customMaster": {
    "limit": 500
  }
  ここから追加（先頭にカンマを付けてください）
  ,
    "runMode": {
    "maintenance": true
  }
  ここまで追加
}
```

{% endhint %}

[^1]:


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cimtops.gitbook.io/i-repo-link-manual/dtassudtabsu/meny/dtabsunodta.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
