Learn how to connect to a PostgreSQL database with Exasol and then load data.
The driver for PostgreSQL is pre-installed with Exasol. You can see the driver details in the EXAoperation (Configuration > Software > JDBC Drivers tab).
To view details about data type mappings or to migrate data, see the PostgreSQL to Exasol migration script in our GitHub repository.
The PostgreSQL server must be reachable from the Exasol system.
The user credentials in the connection must be valid.
To create a connection, run the following statement. Replace the connection string and credentials as needed.
CREATE OR REPLACE CONNECTION JDBC_POSTGRESQL
TO 'jdbc:postgresql://192.168.99.100:5432/my_db'
USER 'username'
IDENTIFIED BY 'Exasoltest';
To test the connection, run the following statement.
SELECT * FROM
(IMPORT FROM JDBC AT JDBC_POSTGRESQL
STATEMENT 'select ''Connection works'' '
);
Use IMPORT to load data from a table or SQL statement using the connection that you created.