Skip to content
Closed
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
35 changes: 35 additions & 0 deletions docs/content.zh/docs/connectors/table/jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ JDBC 连接器不是二进制发行版的一部分,请查阅[这里]({{< ref "
| Oracle | `com.oracle.database.jdbc` | `ojdbc8` | [下载](https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8)
| PostgreSQL | `org.postgresql` | `postgresql` | [下载](https://jdbc.postgresql.org/download.html) |
| Derby | `org.apache.derby` | `derby` | [下载](http://db.apache.org/derby/derby_downloads.html) | |
| SQL Server | `com.microsoft.sqlserver` | `mssql-jdbc` | [下载](https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver16) |

当前,JDBC 连接器和驱动不在 Flink 二进制发布包中,请参阅[这里]({{< ref "docs/dev/configuration" >}})了解在集群上执行时何连接它们。

Expand Down Expand Up @@ -340,6 +341,13 @@ lookup cache 的主要目的是用于提高时态表关联 JDBC 连接器的性
<td>PostgreSQL</td>
<td>INSERT .. ON CONFLICT .. DO UPDATE SET ..</td>
</tr>
<tr>
<td>MS SQL Server</td>
<td>MERGE INTO .. USING (..) ON (..) <br>
WHEN MATCHED THEN UPDATE SET (..) <br>
WHEN NOT MATCHED THEN INSERT (..) <br>
VALUES (..)</td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -552,6 +560,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
<th class="text-left"><a href="https://dev.mysql.com/doc/refman/8.0/en/data-types.html">MySQL type</a></th>
<th class="text-left"><a href="https://docs.oracle.com/database/121/SQLRF/sql_elements001.htm#SQLRF30020">Oracle type</a></th>
<th class="text-left"><a href="https://www.postgresql.org/docs/12/datatype.html">PostgreSQL type</a></th>
<th class="text-left"><a href="https://docs.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql?view=sql-server-ver16">SQL Server type</a></th>
<th class="text-left"><a href="{{< ref "docs/dev/table/types" >}}">Flink SQL type</a></th>
</tr>
</thead>
Expand All @@ -561,6 +570,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
<td></td>
<td></td>
<td><code>TINYINT</code></td>
<td><code>TINYINT</code></td>
</tr>
<tr>
<td>
Expand All @@ -573,6 +583,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
<code>SMALLSERIAL</code><br>
<code>SERIAL2</code></td>
<td><code>SMALLINT</code></td>
<td><code>SMALLINT</code></td>
</tr>
<tr>
<td>
Expand All @@ -584,6 +595,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
<code>INTEGER</code><br>
<code>SERIAL</code></td>
<td><code>INT</code></td>
<td><code>INT</code></td>
</tr>
<tr>
<td>
Expand All @@ -594,11 +606,13 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
<code>BIGINT</code><br>
<code>BIGSERIAL</code></td>
<td><code>BIGINT</code></td>
<td><code>BIGINT</code></td>
</tr>
<tr>
<td><code>BIGINT UNSIGNED</code></td>
<td></td>
<td></td>
<td></td>
<td><code>DECIMAL(20, 0)</code></td>
</tr>
<tr>
Expand All @@ -614,6 +628,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
<td>
<code>REAL</code><br>
<code>FLOAT4</code></td>
<td><code>REAL</code></td>
<td><code>FLOAT</code></td>
</tr>
<tr>
Expand All @@ -624,6 +639,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
<td>
<code>FLOAT8</code><br>
<code>DOUBLE PRECISION</code></td>
<td><code>FLOAT</code></td>
<td><code>DOUBLE</code></td>
</tr>
<tr>
Expand All @@ -640,31 +656,39 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
<code>NUMERIC(p, s)</code><br>
<code>DECIMAL(p, s)</code></td>
<td><code>DECIMAL(p, s)</code></td>
<td><code>DECIMAL(p, s)</code></td>
</tr>
<tr>
<td>
<code>BOOLEAN</code><br>
<code>TINYINT(1)</code></td>
<td></td>
<td><code>BOOLEAN</code></td>
<td><code>BIT</code></td>
<td><code>BOOLEAN</code></td>
</tr>
<tr>
<td><code>DATE</code></td>
<td><code>DATE</code></td>
<td><code>DATE</code></td>
<td><code>DATE</code></td>
<td><code>DATE</code></td>
</tr>
<tr>
<td><code>TIME [(p)]</code></td>
<td><code>DATE</code></td>
<td><code>TIME [(p)] [WITHOUT TIMEZONE]</code></td>
<td><code>TIME(0)</code></td>
<td><code>TIME [(p)] [WITHOUT TIMEZONE]</code></td>
</tr>
<tr>
<td><code>DATETIME [(p)]</code></td>
<td><code>TIMESTAMP [(p)] [WITHOUT TIMEZONE]</code></td>
<td><code>TIMESTAMP [(p)] [WITHOUT TIMEZONE]</code></td>
<td>
<code>DATETIME</code>
<code>DATETIME2</code>
</td>
<td><code>TIMESTAMP [(p)] [WITHOUT TIMEZONE]</code></td>
</tr>
<tr>
Expand All @@ -682,6 +706,13 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
<code>VARCHAR(n)</code><br>
<code>CHARACTER VARYING(n)</code><br>
<code>TEXT</code></td>
<td>
<code>CHAR(n)</code><br>
<code>NCHAR(n)</code><br>
<code>VARCHAR(n)</code><br>
<code>NVARCHAR(n)</code><br>
<code>TEXT</code><br>
<code>NTEXT</code></td>
<td><code>STRING</code></td>
</tr>
<tr>
Expand All @@ -693,12 +724,16 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
<code>RAW(s)</code><br>
<code>BLOB</code></td>
<td><code>BYTEA</code></td>
<td>
<code>BINARY(n)</code><br>
<code>VARBINARY(n)</code><br></td>
<td><code>BYTES</code></td>
</tr>
<tr>
<td></td>
<td></td>
<td><code>ARRAY</code></td>
<td></td>
<td><code>ARRAY</code></td>
</tr>
</tbody>
Expand Down
53 changes: 41 additions & 12 deletions docs/content/docs/connectors/table/jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ See how to link with it for cluster execution [here]({{< ref "docs/dev/configura

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

| Driver | Group Id | Artifact Id | JAR |
| :-----------| :------------------| :----------------------| :----------------|
| MySQL | `mysql` | `mysql-connector-java` | [Download](https://repo.maven.apache.org/maven2/mysql/mysql-connector-java/) |
| Oracle | `com.oracle.database.jdbc` | `ojdbc8` | [Download](https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8) |
| PostgreSQL | `org.postgresql` | `postgresql` | [Download](https://jdbc.postgresql.org/download.html) |
| Derby | `org.apache.derby` | `derby` | [Download](http://db.apache.org/derby/derby_downloads.html) |
| Driver | Group Id | Artifact Id | JAR |
|:-----------| :------------------| :----------------------| :----------------|
| MySQL | `mysql` | `mysql-connector-java` | [Download](https://repo.maven.apache.org/maven2/mysql/mysql-connector-java/) |
| Oracle | `com.oracle.database.jdbc` | `ojdbc8` | [Download](https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8) |
| PostgreSQL | `org.postgresql` | `postgresql` | [Download](https://jdbc.postgresql.org/download.html) |
| Derby | `org.apache.derby` | `derby` | [Download](http://db.apache.org/derby/derby_downloads.html) |
| SQL Server | `com.microsoft.sqlserver` | `mssql-jdbc` | [Download](https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver16) |


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" >}}).
Expand Down Expand Up @@ -347,6 +348,13 @@ As there is no standard syntax for upsert, the following table describes the dat
<td>PostgreSQL</td>
<td>INSERT .. ON CONFLICT .. DO UPDATE SET ..</td>
</tr>
<tr>
<td>MS SQL Server</td>
<td>MERGE INTO .. USING (..) ON (..) <br>
WHEN MATCHED THEN UPDATE SET (..) <br>
WHEN NOT MATCHED THEN INSERT (..) <br>
VALUES (..)</td>
</tr>
</tbody>
</table>

Expand Down Expand Up @@ -546,6 +554,7 @@ Flink supports connect to several databases which uses dialect like MySQL, Oracl
<th class="text-left"><a href="https://dev.mysql.com/doc/refman/8.0/en/data-types.html">MySQL type</a></th>
<th class="text-left"><a href="https://docs.oracle.com/database/121/SQLRF/sql_elements001.htm#SQLRF30020">Oracle type</a></th>
<th class="text-left"><a href="https://www.postgresql.org/docs/12/datatype.html">PostgreSQL type</a></th>
<th class="text-left"><a href="https://docs.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql?view=sql-server-ver16">SQL Server type</a></th>
<th class="text-left"><a href="{{< ref "docs/dev/table/types" >}}">Flink SQL type</a></th>
</tr>
</thead>
Expand All @@ -555,6 +564,7 @@ Flink supports connect to several databases which uses dialect like MySQL, Oracl
<td></td>
<td></td>
<td><code>TINYINT</code></td>
<td><code>TINYINT</code></td>
</tr>
<tr>
<td>
Expand All @@ -567,6 +577,7 @@ Flink supports connect to several databases which uses dialect like MySQL, Oracl
<code>SMALLSERIAL</code><br>
<code>SERIAL2</code></td>
<td><code>SMALLINT</code></td>
<td><code>SMALLINT</code></td>
</tr>
<tr>
<td>
Expand All @@ -578,6 +589,7 @@ Flink supports connect to several databases which uses dialect like MySQL, Oracl
<code>INTEGER</code><br>
<code>SERIAL</code></td>
<td><code>INT</code></td>
<td><code>INT</code></td>
</tr>
<tr>
<td>
Expand All @@ -588,18 +600,14 @@ Flink supports connect to several databases which uses dialect like MySQL, Oracl
<code>BIGINT</code><br>
<code>BIGSERIAL</code></td>
<td><code>BIGINT</code></td>
<td><code>BIGINT</code></td>
</tr>
<tr>
<td><code>BIGINT UNSIGNED</code></td>
<td></td>
<td></td>
<td><code>DECIMAL(20, 0)</code></td>
</tr>
<tr>
<td><code>BIGINT</code></td>
<td></td>
<td><code>BIGINT</code></td>
<td><code>BIGINT</code></td>
<td><code>DECIMAL(20, 0)</code></td>
</tr>
<tr>
<td><code>FLOAT</code></td>
Expand All @@ -608,6 +616,7 @@ Flink supports connect to several databases which uses dialect like MySQL, Oracl
<td>
<code>REAL</code><br>
<code>FLOAT4</code></td>
<td><code>REAL</code></td>
<td><code>FLOAT</code></td>
</tr>
<tr>
Expand All @@ -618,6 +627,7 @@ Flink supports connect to several databases which uses dialect like MySQL, Oracl
<td>
<code>FLOAT8</code><br>
<code>DOUBLE PRECISION</code></td>
<td><code>FLOAT</code></td>
<td><code>DOUBLE</code></td>
</tr>
<tr>
Expand All @@ -634,31 +644,39 @@ Flink supports connect to several databases which uses dialect like MySQL, Oracl
<code>NUMERIC(p, s)</code><br>
<code>DECIMAL(p, s)</code></td>
<td><code>DECIMAL(p, s)</code></td>
<td><code>DECIMAL(p, s)</code></td>
</tr>
<tr>
<td>
<code>BOOLEAN</code><br>
<code>TINYINT(1)</code></td>
<td></td>
<td><code>BOOLEAN</code></td>
<td><code>BIT</code></td>
<td><code>BOOLEAN</code></td>
</tr>
<tr>
<td><code>DATE</code></td>
<td><code>DATE</code></td>
<td><code>DATE</code></td>
<td><code>DATE</code></td>
<td><code>DATE</code></td>
</tr>
<tr>
<td><code>TIME [(p)]</code></td>
<td><code>DATE</code></td>
<td><code>TIME [(p)] [WITHOUT TIMEZONE]</code></td>
<td><code>TIME(0)</code></td>
<td><code>TIME [(p)] [WITHOUT TIMEZONE]</code></td>
</tr>
<tr>
<td><code>DATETIME [(p)]</code></td>
<td><code>TIMESTAMP [(p)] [WITHOUT TIMEZONE]</code></td>
<td><code>TIMESTAMP [(p)] [WITHOUT TIMEZONE]</code></td>
<td>
<code>DATETIME</code>
<code>DATETIME2</code>
</td>
<td><code>TIMESTAMP [(p)] [WITHOUT TIMEZONE]</code></td>
</tr>
<tr>
Expand All @@ -676,6 +694,13 @@ Flink supports connect to several databases which uses dialect like MySQL, Oracl
<code>VARCHAR(n)</code><br>
<code>CHARACTER VARYING(n)</code><br>
<code>TEXT</code></td>
<td>
<code>CHAR(n)</code><br>
<code>NCHAR(n)</code><br>
<code>VARCHAR(n)</code><br>
<code>NVARCHAR(n)</code><br>
<code>TEXT</code><br>
<code>NTEXT</code></td>
<td><code>STRING</code></td>
</tr>
<tr>
Expand All @@ -687,12 +712,16 @@ Flink supports connect to several databases which uses dialect like MySQL, Oracl
<code>RAW(s)</code><br>
<code>BLOB</code></td>
<td><code>BYTEA</code></td>
<td>
<code>BINARY(n)</code><br>
<code>VARBINARY(n)</code><br></td>
<td><code>BYTES</code></td>
</tr>
<tr>
<td></td>
<td></td>
<td><code>ARRAY</code></td>
<td></td>
<td><code>ARRAY</code></td>
</tr>
</tbody>
Expand Down
16 changes: 16 additions & 0 deletions flink-connectors/flink-connector-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ under the License.
<scope>provided</scope>
</dependency>

<!-- SQL Server -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>10.2.1.jre8</version>
<scope>provided</scope>
</dependency>

<!-- Tests -->

<dependency>
Expand Down Expand Up @@ -157,6 +165,14 @@ under the License.
<scope>test</scope>
</dependency>

<!-- MS SQL test -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mssqlserver</artifactId>
<version>1.17.3</version>
<scope>test</scope>
</dependency>

<!-- H2 tests -->
<dependency>
<groupId>com.h2database</groupId>
Expand Down
Loading