Skip to main content
Version: 2.1.0

Jdbc

Sink plugin : Jdbc [Flink]

Description​

Write data through jdbc

Options​

nametyperequireddefault value
driverstringyes-
urlstringyes-
usernamestringyes-
passwordstringno-
querystringyes-
batch_sizeintno-
source_table_namestringyes-
common-optionsstringno-
parallelismintno-

driver [string]​

Driver name, such as com.mysql.cj.jdbc.Driver for MySQL.

Warn: for license compliance, you have to provide MySQL JDBC driver yourself, e.g. copy mysql-connector-java-xxx.jar to $FLINK_HOME/lib for Standalone.

url [string]​

The URL of the JDBC connection. Such as: jdbc:mysql://localhost:3306/test

username [string]​

username

password [string]​

password

query [string]​

Insert statement

batch_size [int]​

Number of writes per batch

parallelism [int]​

The parallelism of an individual operator, for JdbcSink.

common options [string]​

Sink plugin common parameters, please refer to Sink Plugin for details

Examples​

   JdbcSink {
source_table_name = fake
driver = com.mysql.jdbc.Driver
url = "jdbc:mysql://localhost/test"
username = root
query = "insert into test(name,age) values(?,?)"
batch_size = 2
}