Load data from DB2
This article 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.
Add JDBC driver
To add the JDBC driver, create a configuration file called settings.cfg
with the following settings:
Follow the procedure described in Add JDBC Driver to upload the settings.cfg
configuration and JDBC driver files to Exasol.
With some driver versions you may receive an error message indicating file permission issues. In this case you may have to disable the security manager by adding the line NOSECURITY=YES
to the settings.cfg file.
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.