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:
- Click Connections in the left-side menu.
- Click Add new connection.
- Search for
IBM Db2. - Select IBM Db2.
- Click Add new data source.
Configure connection settings
Enter the connection details for your IBM Db2 database. All fields in this section are required.
Configure authentication
Enter the credentials and security settings for your database connection.
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:
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:
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
})
}


