Grafana Cloud Enterprise

Configure the IBM Db2 data source

This document explains how to configure the IBM Db2 data source plugin.

For general information on adding data sources, refer to Add a data source.

Before you begin

Before you configure the data source, ensure you have:

  • IBM Db2 plugin: Install the plugin from the Grafana plugin catalog.
  • Grafana permissions: Organization administrator role or equivalent.
  • IBM Db2 database: A running database configured for external access.
  • Network access: Connectivity from Grafana to the Db2 server host and port.

Add the data source

To add the data source:

  1. Click Connections in the left-side menu.
  2. Click Add new connection.
  3. Search for IBM Db2.
  4. Select IBM Db2.
  5. Click Add new data source.

Configure connection settings

Enter the connection details for your IBM Db2 database. All fields in this section are required.

SettingDescription
Host URLThe hostname and port of your Db2 server in host:port format. Example: db2.example.com:50000.
Database nameThe name of the database to connect to. Example: SAMPLE.

Configure authentication

Enter the credentials and security settings for your database connection.

SettingDescription
UsernameRequired. The database user for authentication. Example: db2inst1.
PasswordRequired. The password for the database user. This value is stored securely.
SSL ConnectionEnable or disable SSL/TLS encryption. Enabled by default.

Verify the connection

Click Save & test to verify the connection to your IBM Db2 database.

A successful connection displays the message Data source is working.

Provision the data source

You can define the data source using YAML files as part of the Grafana provisioning system. For more information, refer to Provisioning Grafana.

Example provisioning configuration:

YAML
apiVersion: 1

datasources:
  - name: IBM Db2
    type: grafana-ibmdb2-datasource
    access: proxy
    jsonData:
      settings:
        - name: host
          value: <DB2_HOST>
        - name: port
          value: '<DB2_PORT>'
        - name: database
          value: <DATABASE_NAME>
        - name: username
          value: <USERNAME>
        - name: sslConnection
          value: 'true'
        - name: password
          secure: true
    secureJsonData:
      password: <PASSWORD>

Configure the data source with Terraform

You can use the Grafana Terraform provider to manage the IBM Db2 data source as code.

Example Terraform configuration:

hcl
resource "grafana_data_source" "ibm_db2" {
  type = "grafana-ibmdb2-datasource"
  name = "IBM Db2"

  json_data_encoded = jsonencode({
    settings = [
      { name = "host", value = "<DB2_HOST>" },
      { name = "port", value = "<DB2_PORT>" },
      { name = "database", value = "<DATABASE_NAME>" },
      { name = "username", value = "<USERNAME>" },
      { name = "sslConnection", value = "true" },
      { name = "password", secure = true }
    ]
  })

  secure_json_data_encoded = jsonencode({
    password = var.db2_password
  })
}