Loading Data from PostgreSQL

This section describes how you can connect PostgreSQL with Exasol and then load data.

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

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=PostgreSQL
JAR=postgresql-42.5.0.jar
DRIVERMAIN=org.postgresql.Driver
PREFIX=jdbc:postgresql:
NOSECURITY=NO
FETCHSIZE=100000
INSERTSIZE=-1

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_POSTGRESQL
 TO 'jdbc:postgresql://192.168.99.100:5432/my_db'
 USER 'username'
 IDENTIFIED BY 'Exasoltest';

Run the following statement to test the connection.

 SELECT * FROM 
 (IMPORT FROM JDBC AT JDBC_POSTGRESQL
   STATEMENT 'select ''Connection works'' '
  );

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.

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