@@ -47,17 +47,18 @@ JDBC 连接器不是二进制发行版的一部分,请查阅[这里]({{< ref "
4747
4848在连接到具体数据库时,也需要对应的驱动依赖,目前支持的驱动如下:
4949
50- | Driver | Group Id | Artifact Id | JAR |
51- | :-----------| :---------------------------| :-----------------------| :----------------------------------------------------------------------------------------------------------------------------|
52- | MySQL | ` mysql ` | ` mysql-connector-java ` | [ 下载] ( https://repo.maven.apache.org/maven2/mysql/mysql-connector-java/ ) |
53- | Oracle | ` com.oracle.database.jdbc ` | ` ojdbc8 ` | [ 下载] ( https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8 ) |
54- | PostgreSQL | ` org.postgresql ` | ` postgresql ` | [ 下载] ( https://jdbc.postgresql.org/download/ ) |
55- | Derby | ` org.apache.derby ` | ` derby ` | [ 下载] ( http://db.apache.org/derby/derby_downloads.html ) |
56- | 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 ) |
57- | CrateDB | ` io.crate ` | ` crate-jdbc ` | [ 下载] ( https://repo1.maven.org/maven2/io/crate/crate-jdbc/ ) |
58- | Db2 | ` com.ibm.db2.jcc ` | ` db2jcc ` | [ 下载] ( https://www.ibm.com/support/pages/download-db2-fix-packs-version-db2-linux-unix-and-windows ) |
59- | Trino | ` io.trino ` | ` trino-jdbc ` | [ 下载] ( https://repo1.maven.org/maven2/io/trino/trino-jdbc/ ) |
60- | OceanBase | ` com.oceanbase ` | ` oceanbase-client ` | [ 下载] ( https://repo1.maven.org/maven2/com/oceanbase/oceanbase-client/ ) |
50+ | Driver | Group Id | Artifact Id | JAR |
51+ | :-----------| :---------------------------| :----------------------------| :----------------------------------------------------------------------------------------------------------------------------|
52+ | MySQL | ` mysql ` | ` mysql-connector-java ` | [ 下载] ( https://repo.maven.apache.org/maven2/mysql/mysql-connector-java/ ) |
53+ | Oracle | ` com.oracle.database.jdbc ` | ` ojdbc8 ` | [ 下载] ( https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8 ) |
54+ | PostgreSQL | ` org.postgresql ` | ` postgresql ` | [ 下载] ( https://jdbc.postgresql.org/download/ ) |
55+ | Derby | ` org.apache.derby ` | ` derby ` | [ 下载] ( http://db.apache.org/derby/derby_downloads.html ) |
56+ | 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 ) |
57+ | CrateDB | ` io.crate ` | ` crate-jdbc ` | [ 下载] ( https://repo1.maven.org/maven2/io/crate/crate-jdbc/ ) |
58+ | Db2 | ` com.ibm.db2.jcc ` | ` db2jcc ` | [ 下载] ( https://www.ibm.com/support/pages/download-db2-fix-packs-version-db2-linux-unix-and-windows ) |
59+ | Trino | ` io.trino ` | ` trino-jdbc ` | [ 下载] ( https://repo1.maven.org/maven2/io/trino/trino-jdbc/ ) |
60+ | OceanBase | ` com.oceanbase ` | ` oceanbase-client ` | [ 下载] ( https://repo1.maven.org/maven2/com/oceanbase/oceanbase-client/ ) |
61+ | Spanner | ` com.google.cloud ` | ` google-cloud-spanner-jdbc ` | [ 下载] ( https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner-jdbc ) |
6162
6263当前,JDBC 连接器和驱动不在 Flink 二进制发布包中,请参阅[ 这里] ({{< ref "docs/dev/configuration/overview" >}})了解在集群上执行时如何连接它们。
6364
@@ -434,6 +435,10 @@ lookup cache 的主要目的是用于提高时态表关联 JDBC 连接器的性
434435 WHEN NOT MATCHED THEN INSERT (..) <br>
435436 VALUES (..)</td>
436437 </tr>
438+ <tr>
439+ <td>Spanner</td>
440+ <td>INSERT OR UPDATE INTO .. (..) VALUES (..)</td>
441+ </tr>
437442 </tbody>
438443</table >
439444
@@ -473,6 +478,7 @@ JDBC catalog 支持以下参数:
473478 - 对于 Postgres Catalog ` base-url ` 应为 ` "jdbc:postgresql://<ip>:<port>" ` 的格式。
474479 - 对于 MySQL Catalog ` base-url ` 应为 ` "jdbc:mysql://<ip>:<port>" ` 的格式。
475480 - 对于 OceanBase Catalog ` base-url ` 应为 ` "jdbc:oceanbase://<ip>:<port>" ` 的格式。
481+ - 对于 Spanner Catalog ` base-url ` 应为 ` "jdbc:cloudspanner:/projects/<project>/instances/<instance>/databases/<database>" ` 的格式。
476482- ` compatible-mode ` : 选填,数据库的兼容模式。
477483
478484{{< tabs "10bd8bfb-674c-46aa-8a36-385537df5791" >}}
@@ -709,7 +715,7 @@ SELECT * FROM given_database.test_table2;
709715
710716数据类型映射
711717----------------
712- Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、Oracle、PostgreSQL、CrateDB, Derby、Db2、 SQL Server、OceanBase 等。其中,Derby 通常是用于测试目的。下表列出了从关系数据库数据类型到 Flink SQL 数据类型的类型映射,映射表可以使得在 Flink 中定义 JDBC 表更加简单。
718+ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、Oracle、PostgreSQL、CrateDB, Derby、Db2、 SQL Server、OceanBase、Spanner 等。其中,Derby 通常是用于测试目的。下表列出了从关系数据库数据类型到 Flink SQL 数据类型的类型映射,映射表可以使得在 Flink 中定义 JDBC 表更加简单。
713719
714720<table class =" table table-bordered " >
715721 <thead>
@@ -723,6 +729,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
723729 <th class="text-left"><a href="https://trino.io/docs/current/language/types.html">Trino type</a></th>
724730 <th class="text-left"><a href="https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000222199">OceanBase MySQL mode type</a></th>
725731 <th class="text-left"><a href="https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000222012">OceanBase Oracle mode type</a></th>
732+ <th class="text-left"><a href="https://cloud.google.com/spanner/docs/reference/standard-sql/data-types">Spanner type</a></th>
726733 <th class="text-left"><a href="{{< ref "docs/dev/table/types" >}}">Flink SQL type</a></th>
727734 </tr>
728735 </thead>
@@ -737,6 +744,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
737744 <td><code>TINYINT</code></td>
738745 <td><code>TINYINT</code></td>
739746 <td></td>
747+ <td></td>
740748 <td><code>TINYINT</code></td>
741749 </tr>
742750 <tr>
@@ -759,6 +767,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
759767 <code>SMALLINT</code><br>
760768 <code>TINYINT UNSIGNED</code></td>
761769 <td></td>
770+ <td></td>
762771 <td><code>SMALLINT</code></td>
763772 </tr>
764773 <tr>
@@ -781,6 +790,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
781790 <code>MEDIUMINT</code><br>
782791 <code>SMALLINT UNSIGNED</code></td>
783792 <td></td>
793+ <td></td>
784794 <td><code>INT</code></td>
785795 </tr>
786796 <tr>
@@ -801,6 +811,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
801811 <code>BIGINT</code><br>
802812 <code>INT UNSIGNED</code></td>
803813 <td></td>
814+ <td>INT64</td>
804815 <td><code>BIGINT</code></td>
805816 </tr>
806817 <tr >
@@ -813,6 +824,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
813824 <td></td>
814825 <td><code>BIGINT UNSIGNED</code></td>
815826 <td></td>
827+ <td>NUMERIC</td>
816828 <td><code>DECIMAL(20, 0)</code></td>
817829 </tr>
818830 <tr>
@@ -831,6 +843,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
831843 <td><code>FLOAT</code></td>
832844 <td>
833845 <code>BINARY_FLOAT</code></td>
846+ <td><code>FLOAT32</code></td>
834847 <td><code>FLOAT</code></td>
835848 </tr>
836849 <tr>
@@ -849,6 +862,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
849862 <td><code>DOUBLE</code></td>
850863 <td><code>DOUBLE</code></td>
851864 <td><code>BINARY_DOUBLE</code></td>
865+ <td><code>FLOAT64</code></td>
852866 <td><code>DOUBLE</code></td>
853867 </tr>
854868 <tr>
@@ -877,6 +891,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
877891 <td>
878892 <code>FLOAT(s)</code><br>
879893 <code>NUMBER(p, s)</code></td>
894+ <td><code>NUMERIC</code></td>
880895 <td><code>DECIMAL(p, s)</code></td>
881896 </tr>
882897 <tr>
@@ -894,6 +909,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
894909 <code>TINYINT(1)</code></td>
895910 <td></td>
896911 <td><code>BOOLEAN</code></td>
912+ <td><code>BOOLEAN</code></td>
897913 </tr>
898914 <tr>
899915 <td><code>DATE</code></td>
@@ -906,6 +922,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
906922 <td><code>DATE</code></td>
907923 <td><code>DATE</code></td>
908924 <td><code>DATE</code></td>
925+ <td><code>DATE</code></td>
909926 </tr>
910927 <tr>
911928 <td><code>TIME [(p)]</code></td>
@@ -917,6 +934,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
917934 <td><code>TIME_WITHOUT_TIME_ZONE</code></td>
918935 <td><code>TIME [(p)]</code></td>
919936 <td><code>DATE</code></td>
937+ <td><code></code></td>
920938 <td><code>TIME [(p)] [WITHOUT TIMEZONE]</code></td>
921939 </tr>
922940 <tr>
@@ -932,6 +950,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
932950 <td><code>TIMESTAMP_WITHOUT_TIME_ZONE</code></td>
933951 <td><code>DATETIME [(p)]</code></td>
934952 <td><code>TIMESTAMP [(p)] [WITHOUT TIMEZONE]</code></td>
953+ <td><code>TIMESTAMP [(p)]</code></td>
935954 <td><code>TIMESTAMP [(p)] [WITHOUT TIMEZONE]</code></td>
936955 </tr>
937956 <tr>
@@ -980,6 +999,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
980999 <code>NCHAR(n)</code><br>
9811000 <code>VARCHAR2(n)</code><br>
9821001 <code>CLOB</code></td>
1002+ <td><code>STRING(n)</code></td>
9831003 <td><code>STRING</code></td>
9841004 </tr>
9851005 <tr>
@@ -1005,6 +1025,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
10051025 <td>
10061026 <code>RAW(s)</code><br>
10071027 <code>BLOB</code></td>
1028+ <td><code>BYTES(n)</code></td>
10081029 <td><code>BYTES</code></td>
10091030 </tr>
10101031 <tr>
@@ -1018,6 +1039,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
10181039 <td></td>
10191040 <td></td>
10201041 <td><code>ARRAY</code></td>
1042+ <td><code>ARRAY</code></td>
10211043 </tr>
10221044 </tbody>
10231045</table >
0 commit comments