Load data from DB2
This section explains how to connect to a DB2 database with Exasol and then load data.
To view details about data type mappings or to migrate data, see the DB2 to Exasol migration script in our GitHub repository.
Prerequisites
-
The DB2 system must be reachable from the Exasol system.
-
The user credentials in the connection must be valid.
Download driver
Download the compatible JDBC driver from the IBM Support page.
Configure driver in EXAoperation
Do the following to configure the driver in EXAoperation:
- Log in to EXAoperation user interface as an Administrator user.
- Select Configuration > Software and click the JDBC Drivers tab.
- Click Add to add the JDBC driver details.
- Enter the following details for the JDBC properties:
- Driver Name:
DB2
- Main Class:
com.ibm.db2.jcc.DB2Driver
- Prefix:
jdbc:db2:
- Disable Security Manager: Depending on the driver version, this option may need to be checked to bypass restrictions that may otherwise prevent the driver from functioning properly.
- Comment: This is an optional field.
- Driver Name:
- Click Add to save the settings.
- Select the radio button next to the driver from list of JDBC driver.
- Click Choose File to locate the downloaded driver and click Upload to upload the JDBC driver.
Create connection
To create a connection, run the following statement. Replace the connection string and credentials as needed.
CREATE OR REPLACE CONNECTION JDBC_DB2
TO 'jdbc:db2://192.168.99.100:50000/sample'
USER 'db2inst1'
IDENTIFIED BY 'exasol123';
To test the connection, run the following statement.
select * from
(
import from JDBC at JDBC_DB2
statement 'select ''Connection works'' from SYSIBM.SYSDUMMY1'
);
Load data
You can use the IMPORT statement to load data using the connection you created above. IMPORT supports loading data from a table or a SQL statement.