Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion docs/content.zh/docs/connectors/table/jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,25 @@ JDBC 连接器允许使用 JDBC 驱动向任意类型的关系型数据库读取
依赖
------------

使用 JDBC 连接器时, `flink-connector-jdbc-core`, `flink-connector-jdbc-${database}` 和对应的 JDBC 驱动需要添加到依赖中。

{{< sql_connector_download_table "jdbc" >}}

JDBC 连接器不是二进制发行版的一部分,请查阅[这里]({{< ref "docs/dev/configuration/overview" >}})了解如何在集群运行中引用 JDBC 连接器。
连接到对应的数据库时,需要使用对应的 `flink-connector-jdbc-${database}` 依赖和驱动依赖。

支持的 `flink-connector-jdbc-${database}` 依赖如下,其版本需要和 `flink-connector-jdbc-core` 依赖的版本相同:

| Database | Group Id | Artifact Id | JAR |
|:-----------|:--------------------------|:---------------------------------|:--------------------------------------------------------------------------------------------|
| MySQL | `org.apache.flink` | `flink-connector-jdbc-mysql` | [下载](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-mysql/) |
| Oracle | `org.apache.flink` | `flink-connector-jdbc-oracle` | [下载](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-oracle/) |
| PostgreSQL | `org.apache.flink` | `flink-connector-jdbc-postgres` | [下载](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-postgres/) |
| Derby | `org.apache.flink` | `flink-connector-jdbc-core` | [下载](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-core/) |
| SQL Server | `org.apache.flink` | `flink-connector-jdbc-sqlserver` | [下载](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-sqlserver/) |
| CrateDB | `org.apache.flink` | `flink-connector-jdbc-cratedb` | [下载](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-cratedb/) |
| Db2 | `org.apache.flink` | `flink-connector-jdbc-db2` | [下载](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-db2/) |
| Trino | `org.apache.flink` | `flink-connector-jdbc-trino` | [下载](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-trino/) |
| OceanBase | `org.apache.flink` | `flink-connector-jdbc-oceanbase` | [下载](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-oceanbase/) |

在连接到具体数据库时,也需要对应的驱动依赖,目前支持的驱动如下:

Expand Down
24 changes: 20 additions & 4 deletions docs/content/docs/connectors/table/jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,27 @@ The JDBC sink operate in upsert mode for exchange UPDATE/DELETE messages with th
Dependencies
------------

When using the JDBC connector, `flink-connector-jdbc-core`, `flink-connector-jdbc-${database}` and the JDBC driver needs to be added to the dependencies.
Copy link
Contributor

@davidradl davidradl May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: needs -> need
nit2:
Is this accurate?
If I want to connect to Derby I need the flink-connector-jdbc-core and the Derby driver.
If I want to connect to DB2 I need the Derby artifact flink-connector-jdbc-coreand the DB2 driver. I assume I do not need the Derby driver.

It might be clearer to say something like. The flink-connector-jdbc-core contains core JDBC capability, it also has built in support for Derby. To use another database , you need to supply it's flink-connector-jdbc-${database} from the same Flink JDBC connector release and the associated JDBC driver.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the postgres connector and it does not need the jdbc-core .3.30-1.20 from what I see. The jdbc-core and connector-base are transitive depebdencies, at least for lookup joins. I am also willing to fix the comments here if you are busy @ruanhang1993


{{< sql_connector_download_table "jdbc" >}}

The JDBC connector is not part of the binary distribution.
See how to link with it for cluster execution [here]({{< ref "docs/dev/configuration/overview" >}}).
The `flink-connector-jdbc-${database}` dependency and a driver dependency are required to connect to a specified database.

The `flink-connector-jdbc-${database}` dependencies are as follows, whose version should be the same as the `flink-connector-jdbc-core`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: when we say whose version it is not obvious what we mean. I suggest moving it up as per my last comment.


| Database | Group Id | Artifact Id | JAR |
|:-----------|:--------------------------|:---------------------------------|:--------------------------------------------------------------------------------------------------|
| MySQL | `org.apache.flink` | `flink-connector-jdbc-mysql` | [Download](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-mysql/) |
| Oracle | `org.apache.flink` | `flink-connector-jdbc-oracle` | [Download](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-oracle/) |
| PostgreSQL | `org.apache.flink` | `flink-connector-jdbc-postgres` | [Download](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-postgres/) |
| Derby | `org.apache.flink` | `flink-connector-jdbc-core` | [Download](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-core/) |
| SQL Server | `org.apache.flink` | `flink-connector-jdbc-sqlserver` | [Download](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-sqlserver/) |
| CrateDB | `org.apache.flink` | `flink-connector-jdbc-cratedb` | [Download](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-cratedb/) |
| Db2 | `org.apache.flink` | `flink-connector-jdbc-db2` | [Download](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-db2/) |
| Trino | `org.apache.flink` | `flink-connector-jdbc-trino` | [Download](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-trino/) |
| OceanBase | `org.apache.flink` | `flink-connector-jdbc-oceanbase` | [Download](https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-oceanbase/) |

A driver dependency is also required to connect to a specified database. Here are drivers currently supported:
Here are drivers currently supported:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Here are drivers -> Here are the drivers


| Driver | Group Id | Artifact Id | JAR |
|:-----------|:---------------------------|:-----------------------|:----------------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -58,7 +73,8 @@ A driver dependency is also required to connect to a specified database. Here ar
| OceanBase | `com.oceanbase` | `oceanbase-client` | [Download](https://repo1.maven.org/maven2/com/oceanbase/oceanbase-client/) |


JDBC connector and drivers are not part of Flink's binary distribution. See how to link with them for cluster execution [here]({{< ref "docs/dev/configuration/overview" >}}).
JDBC connector and drivers are not part of Flink's binary distribution.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: JDBC connector -> The JDBC connector

See how to link with them for cluster execution [here]({{< ref "docs/dev/configuration/overview" >}}).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: what do we mean by link with. It sounds like linking after compiling. I suggest, See how to use them



How to create a JDBC table
Expand Down
6 changes: 3 additions & 3 deletions docs/data/jdbc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
################################################################################

version: 3.3.0-SNAPSHOT
version: 4.1-SNAPSHOT
variants:
- maven: flink-connector-jdbc
sql_url: https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc/$full_version/flink-connector-jdbc-$full_version.jar
- maven: flink-connector-jdbc-core
sql_url: https://repo.maven.apache.org/maven2/org/apache/flink/flink-connector-jdbc-core/$full_version/flink-connector-jdbc-core-$full_version.jar
2 changes: 1 addition & 1 deletion flink-connector-jdbc-architecture/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ams curious should this be 4.0.1 ?

</parent>

<artifactId>flink-connector-jdbc-architecture</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flink-connector-jdbc-backward-compatibility/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
</parent>

<groupId>org.apache.flink</groupId>
Expand Down
2 changes: 1 addition & 1 deletion flink-connector-jdbc-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ under the License.
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
</parent>

<artifactId>flink-connector-jdbc-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flink-connector-jdbc-cratedb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
</parent>

<artifactId>flink-connector-jdbc-cratedb</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flink-connector-jdbc-db2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
</parent>

<artifactId>flink-connector-jdbc-db2</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flink-connector-jdbc-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
</parent>

<artifactId>flink-connector-jdbc-mysql</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flink-connector-jdbc-oceanbase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
</parent>

<artifactId>flink-connector-jdbc-oceanbase</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flink-connector-jdbc-oracle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
</parent>

<artifactId>flink-connector-jdbc-oracle</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flink-connector-jdbc-postgres/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
</parent>

<artifactId>flink-connector-jdbc-postgres</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flink-connector-jdbc-sqlserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
</parent>

<artifactId>flink-connector-jdbc-sqlserver</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion flink-connector-jdbc-trino/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
</parent>

<artifactId>flink-connector-jdbc-trino</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ under the License.

<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc-parent</artifactId>
<version>4.0-SNAPSHOT</version>
<version>4.1-SNAPSHOT</version>
<name>Flink : Connectors : JDBC : Parent</name>
<packaging>pom</packaging>
<inceptionYear>2022</inceptionYear>
Expand Down