IBM Db2 connection

To access your data in an IBM Db2 database, create a connection asset for it.

IBM Db2 is a database that contains relational data.

Supported versions

IBM Db2 10.1 and later

Create a connection to Db2

To create the connection asset, you need the following connection details:

Connecting to a Db2 instance on Cloud Pak for Data

If you are connecting to a Db2 instance that is in the same instance in Cloud Pak for Data, you can run this command to obtain the hostname and port number:

oc get svc | grep db2

The hostname is the Db2 service name. The service name always starts with c-db2oltp, for example c-db2oltp-1605022957148004-db2u-engn-svc.

The port number is 50000 for a non-SSL connection or 50001 for an SSL connection.

Credentials

If you select Shared, enter your username and password for the server.

If you select Personal, you have one of three choices:

  • Enter your username and password for the server manually.
  • Use secrets from a vault.
  • Select platform login credentials.
    You can use this option only if the Db2 service is hosted on the instance of Cloud Pak for Data that you are connecting to.

For Credentials and Certificates, you can use secrets if a vault is configured for the platform and the service supports vaults. For information, see Using secrets from vaults in connections.

Choose the method for creating a connection based on where you are in the platform

In a project
Click Assets > New asset > Connect to a data source. See Adding a connection to a project.
In a deployment space
Click Add to space > Connection. See Adding connections to a deployment space.
In the Platform assets catalog
Click New connection. See Adding platform connections.

Next step: Add data assets from the connection

Where you can use this connection

You can use Db2 connections in the following workspaces and tools:

Projects

  • AutoAI (Watson Machine Learning)
  • Data Refinery (Watson Studio)
  • Decision Optimization (Watson Studio and Watson Machine Learning)
  • Notebooks (Watson Studio). Click Read data on the Code snippets pane to get the connection credentials and load the data into a data structure. See Load data from data source connections.- SPSS Modeler (SPSS Modeler service)
  • Synthetic Data Generator (Synthetic Data Generator service)

Catalogs

  • Platform assets catalog

Federal Information Processing Standards (FIPS) compliance

  • 4.8.0 and 4.8.1: This connection is compliant with FIPS if you installed Cloud Pak for Data on or prior to January, 22, 2024. However, only Clear text is supported for the Username and Password Security Mechanism.
  • 4.8.2 and later: This connection is not compliant with FIPS, but it is FIPS-tolerant.

Running SQL statements

To ensure that your SQL statements run correctly, refer to the Structured Query Language (SQL) topic in the IBM Db2 product documentation for the correct syntax.

Cloud Pak for Data credentials setup (Optional)

To use Cloud Pak for Data credentials, you must set up JWT token authentication on the Db2 server. For instructions, see Token configuration file.

Learn more

IBM Db2 product documentation

Parent topic: Supported connections