Load data from Amazon Redshift

This article describes how to connect to Amazon Redshift with Exasol and then load data.

To view details about data type mappings or to migrate data, see the Amazon Redshift to Exasol migration script in our GitHub repository.

Prerequisites

  • Amazon Redshift must be reachable from the Exasol system.

  • The user credentials in the connection must be valid.

Download driver

Download the compatible JDBC 4.2 driver from AWS Documentation.

Add JDBC driver

To add the JDBC driver, create a configuration file called settings.cfg with the following settings:

DRIVERNAME=Redshift
PREFIX=jdbc:redshift:
FETCHSIZE=100000
INSERTSIZE=-1
NOSECURITY=YES

Follow the procedure described in Add JDBC Driver to upload the settings.cfg configuration and JDBC driver files to Exasol.

Create connection

To create a connection, run the following statement. Replace the connection string and credentials with the corresponding values for your account.

CREATE OR REPLACE CONNECTION jdbc_connection_1
TO 'jdbc:redshift://example_cluster123.some_region.redshift.amazonaws.com:5439/dev' 
USER 'awsuser' 
IDENTIFIED BY'some_password';

To check the connection, run the following statement.

import from jdbc at jdbc_connection_1 statement 'select 42';

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.

Troubleshooting error messages

Error message 1

[ETL-5] JDBC-Client-Error: Connecting to 'jdbc:redshift://example_cluster123.some_region.redshift.amazonaws.com:5439/dev' as user='awsuser' failed: [Amazon](500150) Error setting/closing connection: Error loading the keystore . (Session: 1622834984232180908)

Solution

Ensure that the settings.cfg file contains the parameter NOSECURITY=YES.

Error message 2

[ETL-5] JDBC-Client-Error: Connecting to 'jdbc:redshift://example_cluster123.some_region.redshift.amazonaws.com:5439/dev' as user='awsuser' failed: [Amazon](500150) Error setting/closing connection: Connection timed out. (Session: 1622834984232180908)

Solution

Check that the security groups on the Redshift side allow your VM/cluster to connect to Redshift.

Error message 3

[ETL-5] JDBC-Client-Error: Connecting to 'jdbc:redshift://example_cluster123.some_region.redshift.amazonaws.com:5439/dev' as user='awsuser' failed: [Amazon](500150) Error setting/closing connection: UnknownHostException. (Session: 1622834984232180908)

Solution

Ensure that a DNS server is configured for the database.

Error message 4

[ETL-5] JDBC-Client-Error: Connecting to 'jdbc:redshift://example_cluster123.some_region.redshift.amazonaws.com:5439/dev' as user='awsuser' failed: SSL error: PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failed

Solution

Add ;ssl=false to the connection string. For example:

jdbc:redshift://example_cluster123.some_region.redshift.amazonaws.com:5439/dev;ssl=false