Load data from Amazon Redshift

Learn 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 the AWS website.

Add JDBC driver

  1. Create a configuration file settings.cfg with the following settings:

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

    The file must end with an empty line (line break followed by zero characters).

  2. Upload the settings.cfg file and the driver .jar file to BucketFS in the Exasol cluster.

    In Exasol 2025.1 and later you can upload files using Exasol Admin. You can also use any compatible file transfer tool, including curl on the command line. See also Manage files in BucketFS.

    In Exasol SaaS you must upload the driver through the web console.

    If the driver was downloaded as a .tar.gz or .zip archive, make sure that you extract and upload only the .jar file along with the settings.cfg file.

    Example (using curl in Linux):
    Copy
    export WRITE_PW=<your_bucketfs_write_password>
    export DATABASE_NODE_IP=<ip_address_of_cluster_node>
    export PORT=<bucketfs_port> # default: 2581

    curl -v --insecure -X PUT -T settings.cfg https://w:$WRITE_PW@$DATABASE_NODE_IP:$PORT/default/drivers/jdbc/exasol/settings.cfg
    curl -v --insecure -X PUT -T exajdbc.jar https://w:$WRITE_PW@$DATABASE_NODE_IP:$PORT/default/drivers/jdbc/exasol/exajdbc.jar

    The option --insecure or -k tells curl to bypass the TLS certificate check. This option allows you to connect to a HTTPS server that does not have a valid certificate. Only use this option if certificate verification is not possible and you trust the server.

Create connection

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

Copy
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.

Copy
import from jdbc at jdbc_connection_1 statement 'select 42';

Load data

Use IMPORT to load data from a table or SQL statement using the connection that you created.

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