Skip to content

docs: add DB2 for i (AS/400) connection guidance - #145

Open
afalahi wants to merge 5 commits into
mainfrom
ali/db2-ibmi-docs
Open

docs: add DB2 for i (AS/400) connection guidance#145
afalahi wants to merge 5 commits into
mainfrom
ali/db2-ibmi-docs

Conversation

@afalahi

@afalahi afalahi commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

  • Bug fix
  • New feature

Documentation follow-up to #140, prompted by a real DB2 for i (AS/400) deployment attempt where connection details copied from an IBM i Access / jt400 setup failed in non-obvious ways.

Adds a "DB2 for i (AS/400)" section to docs/db2.md covering what differs from LUW:

  • Db2 Connect license is a hard prerequisite (SQL1598N without it) — the go/no-go check to run before anything else
  • Port 446 (DDM/DRDA), not 8471 (IBM i Access database host server — a different protocol; fails with SQL30081N)
  • DATABASE must be the RDB name from WRKRDBDIRE, not an application library
  • Libraries map to schemas: ?CurrentSchema= or schema-qualified queries; no DBQ library lists
  • CCSID 65535 columns come back untranslated; cast in the configured query

Useful links:

IBM i differs from LUW on every DSN component: port 446 (DDM/DRDA, not
the 8471 IBM i Access host server), DATABASE is the RDB name rather
than an application library, libraries map to schemas via
CurrentSchema, and a customer-supplied Db2 Connect license is a hard
prerequisite (SQL1598N without it).
@afalahi
afalahi requested a review from a team July 28, 2026 20:30
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Connector PR Review: docs: add DB2 for i (AS/400) connection guidance

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base f45ad4c70e3a.
Review mode: incremental since e60dcd5
View review run

Review Summary

The full PR diff was scanned for security and correctness. The new commit normalizes nullable columns in the DB2 for i example query with COALESCE(TEXT_DESCRIPTION, '') and COALESCE(VARCHAR(PREVIOUS_SIGNON), '') so CEL only ever sees strings and avoids "no such overload" failures on NULL/timestamp values. Verified this is safe downstream: an empty last_login string is skipped in pkg/bsql/resources.go:161, and unparseable values only warn. No new issues found; the ?<...|unquoted> provisioning in examples/db2-test.yml is the documented, value-sanitized baton-sql DDL pattern.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

LUW example syncs authorization IDs and roles from SYSCAT with
grant/revoke provisioning; IBM i example syncs user profiles and group
profile membership from QSYS2, sync-only since profile changes go
through CL commands rather than SQL. Both parse-tested alongside the
existing examples.
Comment thread examples/db2-test.yml
# GRANT is DDL — parameter binding is not allowed, so identifiers are
# inlined with ?<...|unquoted> (values are sanitized, never escaped).
- |
GRANT ROLE ?<role_name|unquoted> TO USER ?<principal_name|unquoted>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: Consider ?<role_name|identifier> / ?<principal_name|identifier> here (and in the revoke/admin queries) instead of unquoted. This connector's own token docs recommend identifier for GRANT/DDL, and the reference redshift-test.yml uses it. unquoted strips every char outside [a-zA-Z0-9_], so a DB2 authorization ID containing a legal special char (e.g. #, $, @) would be silently rewritten and the grant applied to the wrong identifier. Both options are injection-safe; identifier just avoids the silent corruption. (Confidence: medium)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

CEL string operations on NULL or timestamp values fail with "no such
overload"; COALESCE in the query keeps the mapped values string-typed.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant