Loading Data from Hive

This section provides you with information on how to connect and load data from Hive using Cloudera Hive JDBC driver.

Download Driver

Download the compatible Cloudera Hive JDBC driver.

If you want to use any other driver, contact Exasol support team.

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=HiveCloudera
JAR=HiveJDBC41.jar
DRIVERMAIN=com.cloudera.hive.jdbc41.HS2Driver
PREFIX=jdbc:hive2:
NOSECURITY=NO
FETCHSIZE=100000
INSERTSIZE=-1

Depending on the driver version, you may need to set NOSECURITY=YES to bypass restrictions that may otherwise prevent the driver from functioning properly.

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 import your data:

-- Connecting EXAloader via Cloudera Hive driver to Cloudera, 
-- MapR, and Hortonworks Hadoop distributions

-- cloudera-quickstart-vm-5.13.0-0-vmware
create or replace connection hive_conn to 'jdbc:hive2://192.168.42.133:10000' user 
'cloudera' identified by 'cloudera';

-- MapR-Sandbox-For-Hadoop-6.1.0-vmware
create or replace connection hive_conn to 'jdbc:hive2://192.168.42.134:10000' user 
'mapr' identified by 'mapr';

-- Azure Hortonworks Sandbox with HDP 2.6.4
create or replace connection hive_conn to 'jdbc:hive2://192.168.42.1:10000' user 
'raj_ops' identified by 'raj_ops';


-- EXPORT test for Cloudera driver
export exa_syscat
    into jdbc driver = 'HiveCloudera' at hive_conn table exa_syscat created by
    'create table exa_syscat (schema_name varchar(128), object_name varchar(128),
 object_type varchar(15), object_comment varchar(2000))'
    replace;

-- IMPORT test for Cloudera driver
import into(schema_name varchar(128), object_name varchar(128), object_type varchar(15), 
object_comment varchar(2000))
    from jdbc driver = 'HiveCloudera' at hive_conn table exa_syscat;

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.

The IMPORT statement allows you to use Kerberos connections in your connection string. For more details, see the example in connection_def.