IBM Db2
This guide walks you through connecting your IBM Db2 database to Solid. By the end, Solid will be able to discover your data, collect metadata, and analyze query history.
Overview
This guide walks you through connecting your IBM Db2 database to Solid. By the end, Solid will be able to discover your data, collect metadata, and analyze query history.
Make sure you have the following:
- Admin access to the Db2 database you want to connect
- A SQL client (e.g., Db2 Command Line Processor, Data Studio, or similar)
- The database alias/name and port — you'll need these for the Solid connection string
- Schema-scoped
SELECTaccess for Solid's user — this is required, not optional, for Solid's Text2SQL engine to generate and validate SQL
What Is Collected
| Category | What | Why |
|---|---|---|
| Metadata | Table and column names, types, and properties | To build the data catalog |
| Metadata | Primary and foreign key relationships | To map data lineage |
| Metadata | Schema and object ownership | To organize by team and domain |
| Metadata | Table and column comments | To surface business descriptions |
| Query History | SQL statement text (SELECT only) | To learn which tables and columns are popular |
| Query History | Executing user | To understand who uses what |
| Query History | Execution timestamps and elapsed time | To identify performance patterns |
| Data Profiling | Sampled rows: MIN/MAX/AVG for numeric columns, distinct value counts for text columns, and null rates | Required for Solid's Text2SQL engine to generate and validate SQL |
Query history requires monitoring to be enabled. Solid reads from Db2's package cache via
MON_GET_PKG_CACHE_STMT. Ensure database monitor switches are on (UPDATE DBM CFG USING DFT_MON_STMT ON).
Automatic Pull (Recommended)
Create the Solid User
Run this script while connected as an admin user on the target database.
-- Create the Solid user
CREATE USER solid_read_only_user;
-- Allow the user to connect to the database
GRANT CONNECT ON DATABASE TO USER solid_read_only_user;
-- Allow read-only access to the schemas you want Solid to monitor
GRANT SELECT ON SCHEMA {schema_name} TO USER solid_read_only_user;
-- Allow visibility into system catalog views (usually granted to PUBLIC by default)
GRANT SELECT ON SYSCAT.TABLES TO USER solid_read_only_user;
GRANT SELECT ON SYSCAT.COLUMNS TO USER solid_read_only_user;
-- Allow visibility into query monitoring functions
GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_PKG_CACHE_STMT TO USER solid_read_only_user;Repeat the GRANT SELECT ON SCHEMA statement for every schema you want Solid to monitor.
Verify the Setup
Log in as solid_read_only_user and run these checks to confirm everything is working.
Check 1 — User can connect
CONNECT TO {database_name} USER solid_read_only_user USING {password};Expected: Connection succeeds without errors.
Check 2 — User can read metadata
SELECT TABSCHEMA, TABNAME
FROM SYSCAT.TABLES
WHERE TABSCHEMA = '{schema_name}'
FETCH FIRST 5 ROWS ONLY;Expected: Rows returned without errors.
Check 3 — User can read table data
SELECT * FROM {schema_name}.{table_name} FETCH FIRST 1 ROW ONLY;Expected: A row returned without errors.
Connect to Solid
In Solid, create a new Db2 data source connection using:
| Field | Value |
|---|---|
| Host | Your Db2 server address |
| Port | 50000 (default) |
| Database name | Your database alias |
| Username | solid_read_only_user |
| Password | The password you set above |
Permissions Needed
| Permission/Grant | Purpose |
|---|---|
CONNECT ON DATABASE | Allows the user to connect to the database |
SELECT ON SCHEMA {schema_name} | Read-only access to the schemas Solid should monitor (repeat per schema) |
SELECT ON SYSCAT.TABLES, SELECT ON SYSCAT.COLUMNS | Visibility into system catalog views (usually granted to PUBLIC by default) |
EXECUTE ON FUNCTION SYSPROC.MON_GET_PKG_CACHE_STMT | Visibility into query monitoring functions, used to collect query history |
Troubleshooting
"Insufficient privileges" errors
- Confirm the
GRANT SELECT ON SCHEMAstatements were run for each schema you want monitored - Verify the user's privileges:
SELECT * FROM SYSCAT.DBAUTH WHERE GRANTEE = 'SOLID_READ_ONLY_USER';
Query history is missing or empty
- Confirm monitor switches are enabled:
GET DBM MONITOR SWITCHES; - Confirm
solid_read_only_userhasEXECUTEonSYSPROC.MON_GET_PKG_CACHE_STMT
Can't connect to the database
- Confirm the database alias and port are correct
- Check the user account isn't locked
- Verify Db2's listener port is reachable from Solid's network
Security Notes
The solid_read_only_user account is built on least-privilege principles:
- Read-only — no
INSERT,UPDATE,DELETE, or DDL privileges - Scoped access — grants are limited to the schemas Solid needs to monitor
Additional recommendations:
- Use a strong, unique password and rotate it per your organization's policy
- Restrict access to Db2's listener port via firewall rules
- Enable SSL for encrypted connections where available
Updated 8 days ago
