[comment]: # translation:outdated

[comment]: # ({677840d9-677840d9})
# 2 PostgreSQLの推奨UnixODBC設定

[comment]: # ({/677840d9-677840d9})

[comment]: # ({58bb731d-041bb1bb})
#### インストール

-   **Red Hat Enterprise Linux**:

```{=html}
<!-- -->
```
    # yum install postgresql-odbc

-   **Debian/Ubuntu**:

対応するプラットフォームのデータベースドライバは、[PostgreSQL documentation](https://www.postgresql.org/download/linux/ubuntu/)を参照し、<br>
対応するプラットフォーム用のデータベースドライバをダウンロードしてください。

追加情報については、[unixODBCのインストール](/manual/config/items/itemtypes/odbc_checks/)を参照してください。

[comment]: # ({/58bb731d-041bb1bb})

[comment]: # ({d41ee6ca-d41ee6ca})
#### 設定

ODBCの設定は、**odbcinst.ini** と **odbc.ini** ファイルを編集することによって行われます。<br>
これらの構成ファイルは、*/etc* フォルダーにあります。**odbcinst.ini**ファイルがない場合があり、<br>
この場合は手動で作成する必要があります。

以下の例を検討してください。<br>
**odbcinst.ini**

    [postgresql]
    Description = General ODBC for PostgreSQL
    Driver      = /usr/lib64/libodbcpsql.so
    Setup       = /usr/lib64/libodbcpsqlS.so
    FileUsage   = 1
    # Since 1.6 if the driver manager was built with thread support you may add another entry to each driver entry.
    # This entry alters the default thread serialization level.
    Threading   = 2

**odbc.ini**

    [TEST_PSQL]
    Description = PostgreSQL database 1
    Driver  = postgresql
    #CommLog = /tmp/sql.log
    Username = zbx_test
    Password = zabbix
    # Name of Server. IP or DNS
    Servername = 127.0.0.1
    # Database name
    Database = zabbix
    # Postmaster listening port
    Port = 5432
    # Database is read only
    # Whether the datasource will allow updates.
    ReadOnly = No
    # PostgreSQL backend protocol
    # Note that when using SSL connections this setting is ignored.
    # 7.4+: Use the 7.4(V3) protocol. This is only compatible with 7.4 and higher backends.
    Protocol = 7.4+
    # Includes the OID in SQLColumns
    ShowOidColumn = No
    # Fakes a unique index on OID
    FakeOidIndex  = No
    # Row Versioning
    # Allows applications to detect whether data has been modified by other users
    # while you are attempting to update a row.
    # It also speeds the update process since every single column does not need to be specified in the where clause to update a row.
    RowVersioning = No
    # Show SystemTables
    # The driver will treat system tables as regular tables in SQLTables. This is good for Access so you can see system tables.
    ShowSystemTables = No
    # If true, the driver automatically uses declare cursor/fetch to handle SELECT statements and keeps 100 rows in a cache.
    Fetch = Yes
    # Bools as Char
    # Bools are mapped to SQL_CHAR, otherwise to SQL_BIT.
    BoolsAsChar = Yes
    # SSL mode
    SSLmode = Yes
    # Send tobackend on connection
    ConnSettings =

[comment]: # ({/d41ee6ca-d41ee6ca})
