JDBC Source

JDBC Source () is used to read data from a relational database system (RDBMS) using JDBC (Java Database Connectivity) .

Data taken from multiple columns in an SQL query will be combined into one output field in string form using a specific separator character .

This component can be used as a replacement for Sqoop , as it is capable of reading data from relational databases and directly storing it to HDFS in flat-file or ORC format .

JDBC Source Function

Some of the main functions of JDBC Source :

Parameters of JDBC Source

1. Required Parameters

2. Partitioning Parameters

3. Incremental Processing

Incremental processing is used to retrieve only new data .
    Parameter       Description
    -----------------------------------------
    Incremental     Enable incremental queries
Example:
    Incremental : true
If active, the system only retrieves data that has never been processed before .

4. Checkpoint Environment Parameters

Checkpoints are used to store the latest information from the data retrieval process .

5. Dynamic Parameters

Parameters that have a flag (*)can be filled dynamically at runtime using:
    FROM_ARGUMENT(arg_name)
Example:
    URL Connection : FROM_ARGUMENT(db_url)
This allows for more flexible configuration when running the pipeline .

Replacing Sqoop with JDBC Source

JDBC Source can fully replace Sqoop by reading data from an RDBMS and loading it directly into HDFS.
Example Data Flows

Notes on Balanced Output

To generate balanced output, use:

ORC Structure Definition via SQL Query

The structure of the ORC file is defined directly in the SQL query using column aliases and data types.
Example Query
SELECT
  rownum AS dw_sk:INT,
  kota,
  sales_id,
  item_id,
  qty AS quantity:INT,
  unit_price:DECIMAL(6,2),
  last_updated_date:TIMESTAMP
FROM penjualan;
Resulting ORC Schema
ORC Field Name Source Column Data Type
dw_sk rownum INT
kota kota STRING
sales_id sales_id STRING
item_id item_id STRING
quantity qty INT
unit_price unit_price DECIMAL(6,2)
last_updated_datelast_updated_dateTIMESTAMP

Supported Engines

Map
Reduce
Spark 1.x
RDD
Spark 2.x
RDD
Spark 2.x
Dataset
Apache Beam
2.29.0 Batch
Apache Beam
2.29.0 Streaming
Apache Flink
1.12.x Batch
Apache Flink
1.12.x Streaming
Apache Tez
0.9.1
PySpark