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 SELECT access for Solid's user — this is required, not optional, for Solid's Text2SQL engine to generate and validate SQL

What Is Collected

CategoryWhatWhy
MetadataTable and column names, types, and propertiesTo build the data catalog
MetadataPrimary and foreign key relationshipsTo map data lineage
MetadataSchema and object ownershipTo organize by team and domain
MetadataTable and column commentsTo surface business descriptions
Query HistorySQL statement text (SELECT only)To learn which tables and columns are popular
Query HistoryExecuting userTo understand who uses what
Query HistoryExecution timestamps and elapsed timeTo identify performance patterns
Data ProfilingSampled rows: MIN/MAX/AVG for numeric columns, distinct value counts for text columns, and null ratesRequired 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:

FieldValue
HostYour Db2 server address
Port50000 (default)
Database nameYour database alias
Usernamesolid_read_only_user
PasswordThe password you set above

Permissions Needed

Permission/GrantPurpose
CONNECT ON DATABASEAllows 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.COLUMNSVisibility into system catalog views (usually granted to PUBLIC by default)
EXECUTE ON FUNCTION SYSPROC.MON_GET_PKG_CACHE_STMTVisibility into query monitoring functions, used to collect query history

Troubleshooting

"Insufficient privileges" errors

  1. Confirm the GRANT SELECT ON SCHEMA statements were run for each schema you want monitored
  2. Verify the user's privileges:
    SELECT * FROM SYSCAT.DBAUTH WHERE GRANTEE = 'SOLID_READ_ONLY_USER';

Query history is missing or empty

  1. Confirm monitor switches are enabled:
    GET DBM MONITOR SWITCHES;
  2. Confirm solid_read_only_user has EXECUTE on SYSPROC.MON_GET_PKG_CACHE_STMT

Can't connect to the database

  1. Confirm the database alias and port are correct
  2. Check the user account isn't locked
  3. 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

Did this page help you?