Load data from Oracle

This article explains how to connect to an Oracle database with Exasol and load data.

For details about data type mappings or to migrate data, see the Oracle to Exasol migration script in our GitHub repository.

We recommend using Oracle Call Interface instead of Oracle JDBC to connect to Exasol.

Prerequisites

  • The Oracle system must be reachable from the Exasol system

  • The user credentials in the connection must be valid.

Oracle Call Interface

Download and add driver

Follow the procedure described in Add Oracle Instant Client to add the thin client to your Exasol environment.

Create connection

To create a connection, run the following statement. Replace the connection string and credentials as needed.

CREATE OR REPLACE CONNECTION OCI_ORACLE
    TO '192.168.99.103:1521/xe'
    USER 'system'
    IDENTIFIED BY 'oracle';

Alternatively, run the following statement:

CREATE CONNECTION OCI_ORACLE TO '(DESCRIPTION =  
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.99.103)(PORT = 1521)) 
      (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = orcl)))';

To test the connection, run the following statement:

SELECT * FROM 
(
IMPORT FROM ORA AT OCI_ORACLE
STATEMENT 'select ''Connection works'' from dual'
);

Oracle JDBC

Download driver

Download the compatible driver from the Oracle JDBC Driver Download Page link.

Add JDBC driver

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

DRIVERNAME=Oracle
PREFIX=jdbc:oracle:thin:
FETCHSIZE=100000
INSERTSIZE=-1

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

If the connection using the Oracle JDBC driver is unsuccessful, try disabling the security manager by adding the line NOSECURITY=YES to the settings.cfg file.

Create connection

To create a connection, run the following statement. Replace the connection string and credentials as needed.

CREATE CONNECTION JDBC_ORACLE
TO 'jdbc:oracle:thin:@//10.78.0.178:1521/orcl'
USER 'exatest'
IDENTIFIED BY 'test';

To test the connection, run the following statement:

SELECT * FROM 
(
IMPORT FROM jdbc AT JDBC_ORACLE
STATEMENT 'select ''Connection works'' from dual'
);

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.