Loading Data from DB2
This section describes how you can connect DB2 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.
Download Driver
Download the compatible JDBC driver from the IBM Support page.
Add JDBC Driver
To add a JDBC driver, you must create a configuration file called settings.cfg
. Use the below settings to create the file, replacing the JAR entry with the name of the jar file you downloaded:
DRIVERNAME=DB2
JAR=db2jcc4.jar
DRIVERMAIN=com.ibm.db2.jcc.DB2Driver
PREFIX=jdbc:db2:
NOSECURITY=NO
FETCHSIZE=100000
INSERTSIZE=-1
Depending on the driver version, you may need to set NOSECURITY=YES
to bypass restrictions that may otherwise prevent the driver from functioning properly.
Follow the procedure described in Add JDBC Drivers to upload the settings.cfg
configuration file and the JDBC driver jar file(s).
Run Statement
Run the following statement to create a connection.
CREATE OR REPLACE CONNECTION JDBC_DB2
TO 'jdbc:db2://192.168.99.100:50000/sample'
USER 'db2inst1'
IDENTIFIED BY 'exasol123';
Run the following statement to test the connection.
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.