Skip to main content
Version: 0.9.0-incubating

Flink connector jdbc catalog

This document provides a comprehensive guide on configuring and using Apache Gravitino Flink connector to access the JDBC catalog managed by the Gravitino server.

Capabilities

Supported JDBC Types

  • MYSQL

Getting Started

Prerequisites

Place the following JAR files in the lib directory of your Flink installation:

SQL Example

-- Suppose jdbc_catalog is the JDBC catalog name managed by Gravitino

USE CATALOG jdbc_catalog;

SHOW DATABASES;
-- +------------------+
-- | database name |
-- +------------------+
-- | mysql |
-- +------------------+

CREATE DATABASE jdbc_database;
-- [INFO] Execute statement succeed.

SHOW DATABASES;
-- +------------------+
-- | database name |
-- +------------------+
-- | mysql |
-- | jdbc_database |
-- +------------------+

USE jdbc_database;
-- [INFO] Execute statement succeed.

SET 'execution.runtime-mode' = 'batch';
-- [INFO] Execute statement succeed.

SET 'sql-client.execution.result-mode' = 'tableau';
-- [INFO] Execute statement succeed.

USE jdbc_database;
-- [INFO] Execute statement succeed.

SHOW TABLES;
-- Empty set

CREATE TABLE jdbc_table_a (
aa BIGINT NOT NULL PRIMARY KEY NOT ENFORCED,
bb BIGINT
);
-- [INFO] Execute statement succeed.

SHOW TABLES;
-- +--------------+
-- | table name |
-- +--------------+
-- | jdbc_table_a |
-- +--------------+
-- 1 row in set

INSERT INTO jdbc_table_a VALUES(1,2);

SELECT * FROM jdbc_table_a;
-- +----+----+
-- | aa | bb |
-- +----+----+
-- | 1 | 2 |
-- +----+----+
-- 1 row in set

INSERT INTO jdbc_table_a VALUES(2,3);
-- [INFO] Submitting SQL update statement to the cluster...
-- [INFO] SQL update statement has been successfully submitted to the cluster:
-- Job ID: bc320828d49b97b684ed9f622f1b8aca

INSERT INTO jdbc_table_a VALUES(1,4);
-- [INFO] Submitting SQL update statement to the cluster...
-- [INFO] SQL update statement has been successfully submitted to the cluster:
-- Job ID: bc320828d49b97b684ed9f622f1b8aca

SELECT * FROM jdbc_table_a;
-- +----+----+
-- | aa | bb |
-- +----+----+
-- | 1 | 4 |
-- | 2 | 3 |
-- +----+----+
-- 2 rows in set

Catalog properties

Gravitino Flink connector will transform below property names which are defined in catalog properties to Flink JDBC connector configuration.

Gravitino catalog property nameFlink JDBC connector configurationDescriptionSince Version
jdbc-urlbase-urlJDBC URL for MYSQL0.9.0-incubating
usernameusernameUsername of MySQL account0.9.0-incubating
passwordpasswordPassword of the account0.9.0-incubating
flink.bypass.default-databasedefault-databaseDefault database to connect to0.9.0-incubating