@@ -47,17 +47,18 @@ JDBC 连接器不是二进制发行版的一部分,请查阅[这里]({{< ref "
47
47
48
48
在连接到具体数据库时,也需要对应的驱动依赖,目前支持的驱动如下:
49
49
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 ) |
61
62
62
63
当前,JDBC 连接器和驱动不在 Flink 二进制发布包中,请参阅[ 这里] ({{< ref "docs/dev/configuration/overview" >}})了解在集群上执行时如何连接它们。
63
64
@@ -434,6 +435,10 @@ lookup cache 的主要目的是用于提高时态表关联 JDBC 连接器的性
434
435
WHEN NOT MATCHED THEN INSERT (..) <br>
435
436
VALUES (..)</td>
436
437
</tr>
438
+ <tr>
439
+ <td>Spanner</td>
440
+ <td>INSERT OR UPDATE INTO .. (..) VALUES (..)</td>
441
+ </tr>
437
442
</tbody>
438
443
</table >
439
444
@@ -473,6 +478,7 @@ JDBC catalog 支持以下参数:
473
478
- 对于 Postgres Catalog ` base-url ` 应为 ` "jdbc:postgresql://<ip>:<port>" ` 的格式。
474
479
- 对于 MySQL Catalog ` base-url ` 应为 ` "jdbc:mysql://<ip>:<port>" ` 的格式。
475
480
- 对于 OceanBase Catalog ` base-url ` 应为 ` "jdbc:oceanbase://<ip>:<port>" ` 的格式。
481
+ - 对于 Spanner Catalog ` base-url ` 应为 ` "jdbc:cloudspanner:/projects/<project>/instances/<instance>/databases/<database>" ` 的格式。
476
482
- ` compatible-mode ` : 选填,数据库的兼容模式。
477
483
478
484
{{< tabs "10bd8bfb-674c-46aa-8a36-385537df5791" >}}
@@ -709,7 +715,7 @@ SELECT * FROM given_database.test_table2;
709
715
710
716
数据类型映射
711
717
----------------
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 表更加简单。
713
719
714
720
<table class =" table table-bordered " >
715
721
<thead>
@@ -723,6 +729,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
723
729
<th class="text-left"><a href="https://trino.io/docs/current/language/types.html">Trino type</a></th>
724
730
<th class="text-left"><a href="https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000222199">OceanBase MySQL mode type</a></th>
725
731
<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>
726
733
<th class="text-left"><a href="{{< ref "docs/dev/table/types" >}}">Flink SQL type</a></th>
727
734
</tr>
728
735
</thead>
@@ -737,6 +744,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
737
744
<td><code>TINYINT</code></td>
738
745
<td><code>TINYINT</code></td>
739
746
<td></td>
747
+ <td></td>
740
748
<td><code>TINYINT</code></td>
741
749
</tr>
742
750
<tr>
@@ -759,6 +767,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
759
767
<code>SMALLINT</code><br>
760
768
<code>TINYINT UNSIGNED</code></td>
761
769
<td></td>
770
+ <td></td>
762
771
<td><code>SMALLINT</code></td>
763
772
</tr>
764
773
<tr>
@@ -781,6 +790,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
781
790
<code>MEDIUMINT</code><br>
782
791
<code>SMALLINT UNSIGNED</code></td>
783
792
<td></td>
793
+ <td></td>
784
794
<td><code>INT</code></td>
785
795
</tr>
786
796
<tr>
@@ -801,6 +811,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
801
811
<code>BIGINT</code><br>
802
812
<code>INT UNSIGNED</code></td>
803
813
<td></td>
814
+ <td>INT64</td>
804
815
<td><code>BIGINT</code></td>
805
816
</tr>
806
817
<tr >
@@ -813,6 +824,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
813
824
<td></td>
814
825
<td><code>BIGINT UNSIGNED</code></td>
815
826
<td></td>
827
+ <td>NUMERIC</td>
816
828
<td><code>DECIMAL(20, 0)</code></td>
817
829
</tr>
818
830
<tr>
@@ -831,6 +843,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
831
843
<td><code>FLOAT</code></td>
832
844
<td>
833
845
<code>BINARY_FLOAT</code></td>
846
+ <td><code>FLOAT32</code></td>
834
847
<td><code>FLOAT</code></td>
835
848
</tr>
836
849
<tr>
@@ -849,6 +862,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
849
862
<td><code>DOUBLE</code></td>
850
863
<td><code>DOUBLE</code></td>
851
864
<td><code>BINARY_DOUBLE</code></td>
865
+ <td><code>FLOAT64</code></td>
852
866
<td><code>DOUBLE</code></td>
853
867
</tr>
854
868
<tr>
@@ -877,6 +891,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
877
891
<td>
878
892
<code>FLOAT(s)</code><br>
879
893
<code>NUMBER(p, s)</code></td>
894
+ <td><code>NUMERIC</code></td>
880
895
<td><code>DECIMAL(p, s)</code></td>
881
896
</tr>
882
897
<tr>
@@ -894,6 +909,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
894
909
<code>TINYINT(1)</code></td>
895
910
<td></td>
896
911
<td><code>BOOLEAN</code></td>
912
+ <td><code>BOOLEAN</code></td>
897
913
</tr>
898
914
<tr>
899
915
<td><code>DATE</code></td>
@@ -906,6 +922,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
906
922
<td><code>DATE</code></td>
907
923
<td><code>DATE</code></td>
908
924
<td><code>DATE</code></td>
925
+ <td><code>DATE</code></td>
909
926
</tr>
910
927
<tr>
911
928
<td><code>TIME [(p)]</code></td>
@@ -917,6 +934,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
917
934
<td><code>TIME_WITHOUT_TIME_ZONE</code></td>
918
935
<td><code>TIME [(p)]</code></td>
919
936
<td><code>DATE</code></td>
937
+ <td><code></code></td>
920
938
<td><code>TIME [(p)] [WITHOUT TIMEZONE]</code></td>
921
939
</tr>
922
940
<tr>
@@ -932,6 +950,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
932
950
<td><code>TIMESTAMP_WITHOUT_TIME_ZONE</code></td>
933
951
<td><code>DATETIME [(p)]</code></td>
934
952
<td><code>TIMESTAMP [(p)] [WITHOUT TIMEZONE]</code></td>
953
+ <td><code>TIMESTAMP [(p)]</code></td>
935
954
<td><code>TIMESTAMP [(p)] [WITHOUT TIMEZONE]</code></td>
936
955
</tr>
937
956
<tr>
@@ -980,6 +999,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
980
999
<code>NCHAR(n)</code><br>
981
1000
<code>VARCHAR2(n)</code><br>
982
1001
<code>CLOB</code></td>
1002
+ <td><code>STRING(n)</code></td>
983
1003
<td><code>STRING</code></td>
984
1004
</tr>
985
1005
<tr>
@@ -1005,6 +1025,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
1005
1025
<td>
1006
1026
<code>RAW(s)</code><br>
1007
1027
<code>BLOB</code></td>
1028
+ <td><code>BYTES(n)</code></td>
1008
1029
<td><code>BYTES</code></td>
1009
1030
</tr>
1010
1031
<tr>
@@ -1018,6 +1039,7 @@ Flink 支持连接到多个使用方言(dialect)的数据库,如 MySQL、O
1018
1039
<td></td>
1019
1040
<td></td>
1020
1041
<td><code>ARRAY</code></td>
1042
+ <td><code>ARRAY</code></td>
1021
1043
</tr>
1022
1044
</tbody>
1023
1045
</table >
0 commit comments