IBM DB2 Connector

Overview

The DB2 Connector is for non-Z-Series implementations. For Z-Series/AS-400 implementations you should leverage the Generic JDBC Connector.

Pod Residency

rdbms-scanner

Connection Method

jdbc

Supported Scan Actions

Scan Type

Description

Catalog

This scan type will only retrieve the metadata in the database like details of schema, table, or column.

Catalog & Scan

This scan type will return both metadata and data under the tables and returns the appropriate labels.

Credential & System Permissions

Important:

OneTrust recommends to adhere to your organization's security and infrastructure policy and include system engineer resources or other qualified subject matter experts to set up credentials on data sources. For specific instructions for how to enable these credentials, refer to your data source's implementation documentation, knowledge base and/or support resources.

A read-only user with permission to scan the scope should be created and used for the credentials.

Sample JSON - 1 DB to scanned

JSON
{
    "connectionUrl": "jdbc:db2://<Host>:<Port>/<DB-Name>:securityMechanism=3;",
    "user": "<User>",
    "password": "<Password>"
}

Sample JSON - Multiple DB2 Instances in the Same Host

JSON
{
    "base_database": "<DB-Name>",
    "connectionUrl": "jdbc:db2://<Host>:<Port>/{db}:securityMechanism=3;",
    "database_list": "<DB1>,<DB2>",
    "password": "<Password>",
    "user": "<User>"
}
Note:

The usage of securityMechanism is described in the official documentation here: IBM DB2 SecurityMechanism. In summary, it defines the method used to connect to the server, and depending on the version of the driver, the default values may change. The credential example provided above is based on the current DB2 driver embedded in the rdbms-scanner.

Generic JDBC Connector

For Z-Series/As 400 implementations only. Download the respective jar based on the DB2 version from official IBM resources.

Generic JDBC requires additional jars to be uploaded to ext lib. Once you download the file please follow the instructions in Generic JDBC Connector.

Sample JSON - Generic JDBC

JSON
{
    "connectionUrl": "jdbc:db2://<Host>:<Port>/<DB-Name>",
    "driver_class_name": "com.ibm.db2.jcc.DB2Driver",
    "password": "<Password>",
    "user": "<User>"
}

Scan Profile Support

Note:

For additional details on scan profile configuration and management, see Setting Up Scan Profiles.

Limits

  • Maximum number of databases.

  • Maximum number of schemas per database.

  • Maximum number of tables per schema.

  • Maximum number of rows per table.

Wildcard

Wildcards are not supported for column inclusion or exclusion.

  • Example: *Name* will not work to include/exclude both firstName and lastName columns

  • Instead, you must specify the exact column names separated by commas (e.g. firstName,lastName).

Important:

Columns Excluded in the Data Dictionary

When a column is excluded, it is still cataloged by the Data Dictionary. This means:

  • Basic metadata for the column is retrieved.

  • During extraction, the actual column content is skipped based on the configuration.

Include/Exclude Path Configuration Fields

  • Database

  • Schema

  • Table

  • Column

Collected Objects & Fields

Object

Field

  • Database

  • Table

  • Column

  • Key

  • Name

  • Field Type

  • Product Family

  • Owner

  • Product Version

  • Product Name

  • Rows Estimate

  • Size Estimate

  • Comment

  • Column Index

  • Nullable

  • Primary Key Name

  • Foreign Key Name

  • Primary Key Columns

  • Foreign Key Columns

Troubleshooting

SQL Error Code

PYTHON
Error SQL error code:-4230 
state:42968 
Exception: com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][t4][10509][13454][4.26.16] Connection to the data server failed. 
The IBM Data Server for JDBC and SQLJ license was invalid or was not activated for the DB2 for z/OS subsystem. 
If you are connecting directly to the data server and using DB2 Connect Unlimited Edition for System z, 
perform the activation step by running the activation program in the license activation kit.
If you are using any other edition of DB2 Connect, obtain the license file, db2jcc_license_cisuz.jar, 
from the license activation kit, and follow the installation directions to include the license file in the class path. 
ERRORCODE=-4230, SQLSTATE=42968

Resolution: upload the db2jcc_license_cisuz.jar to the worker node. Instructions on how to get the file can be found here.

Connection Error Codes

  1. Code 1

    CODE
    [Connection Error] Source:[RDBMS Scanner] Message:[DisconnectNonTransientConnectionException: [jcc][t4][2057][11264][4.33.31] 
    The application server rejected establishment of the connection. 
    An attempt was made to access a database, ssdbip, which was either not found or does not support transactions. 
    ERRORCODE=-4499, SQLSTATE=08004] Arguments:[[Dialect: db2]] Date:[2024-03-15T13:38:27]
  2. Code 2

    CODE
    [Connection Error] Source:[RDBMS Scanner] Message:[SqlInvalidAuthorizationSpecException: [jcc][t4][2010][11246][4.33.31] 
    Connection authorization failure occurred. 
    Reason: Local security service non-retryable error. 
    ERRORCODE=-4214, SQLSTATE=28000] Arguments:[[Dialect: db2]] Date:[2024-03-15T13:40:49]

Resolution: upload the db2jcc4.jar or db2jcc.jar according to your respective version. You can find the version details and respective jar here.