Skip to main content

JDBC Connector Introduction

The JDBC Connector is contributed by the community and supports both reading and writing operations.

Syntax

CREATE TABLE jdbc_table (
id BIGINT,
name VARCHAR,
age INT
) WITH (
type='jdbc',
geaflow.dsl.jdbc.driver = 'org.h2.Driver',
geaflow.dsl.jdbc.url = 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1',
geaflow.dsl.jdbc.username = 'h2_user',
geaflow.dsl.jdbc.password = 'h2_pwd',
geaflow.dsl.jdbc.table.name = 'source_table'
);

Options

KeyRequiredDescription
geaflow.dsl.jdbc.drivertrueThe JDBC driver.
geaflow.dsl.jdbc.urltrueThe database URL.
geaflow.dsl.jdbc.usernametrueThe database username.
geaflow.dsl.jdbc.passwordtrueThe database password.
geaflow.dsl.jdbc.table.nametrueThe table name.
geaflow.dsl.jdbc.partition.numfalseThe JDBC partition number, default 1.
geaflow.dsl.jdbc.partition.columnfalseThe JDBC partition column. Default value is 'id'.
geaflow.dsl.jdbc.partition.lowerboundfalseThe lowerbound of JDBC partition, just used to decide the partition stride, not for filtering the rows in table.
geaflow.dsl.jdbc.partition.upperboundfalseThe upperbound of JDBC partition, just used to decide the partition stride, not for filtering the rows in table.

Example

set geaflow.dsl.jdbc.driver = 'org.h2.Driver';
set geaflow.dsl.jdbc.url = 'jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1';
set geaflow.dsl.jdbc.username = 'h2_user';
set geaflow.dsl.jdbc.password = 'h2_pwd';

CREATE TABLE jdbc_source_table (
id BIGINT,
name VARCHAR,
age INT
) WITH (
type='jdbc',
geaflow.dsl.jdbc.table.name = 'source_table',
);

CREATE TABLE jdbc_sink_table (
id BIGINT,
name VARCHAR,
age INT
) WITH (
type='jdbc',
geaflow.dsl.jdbc.table.name = 'sink_table'
);

INSERT INTO jdbc_sink_table
SELECT * FROM jdbc_source_table;