watsonx.ai
Access Db2 from watsonx.ai
Based on where you are in the platform, choose the method for creating a connection to Db2 on IBM i.
- In a project
Click Assets > New asset > Connect to a data source. See Adding a connection to a project. - In a deployment space
Click Import assets > Data access > Connection. See Adding data assets to a deployment space. - In the Platform assets catalog
Click New connection. See Adding platform connections.
The steps for these three different scenarios are quite similar. In this documentation, it will establish a connection within the project to illustrate the entire process.
Go to the project page, and click the Assets tab
Click New asset > Prepare data > Connect to a data source
Select the IBM Db2 for i connector
Enter the connection information
Typically, you need to provide information like the hostname, port number, username, and password.
Below is port number information based on the JDBC driver and SSL/TLS configuration.
There are two JDBC driver options: IBM JCC driver and JT400 driver. The JT400 driver is preferred because it does not require an additional license like the JCC driver does.
JDBC Driver | Port Non-SSL | Port SSL |
---|---|---|
JCC driver | 446 | 448 |
JT400 driver | 8471 | 9471 |
If the certificate used in SSL/TLS configuration is not signed by a publicly trusted CA, then you need to paste the content of the CA certificate in the SSL certificate text box.
Verify the connection
Click Test connection to verify if the connection can be created successfully
Create the connection
Click Create. The connection appears on the Assets page. You can edit the connection by clicking the connection name on the Assets page.
Add data assets from the connection
A connected data asset is a pointer to data that is accessed through a connection to an external data source. You create a connected data asset by specifying a connection, any intermediate structures or paths, and a relational table or view, a set of partitioned data files, or a file. When you access a connected data asset, the data is dynamically retrieved from the data source. See Add data assets from the connection.
To add a data asset from a connection to a project:
-
From the project page, click the Assets tab, and then click Import assets > Connected data.
-
Select an existing connection asset or create a new one as the source of the data.
-
Select the data you want. You can select multiple connected data assets from the same connection. Click Import.