[refactor](jdbc catalog) Refactor the JdbcClient code (#20109)
This PR does the following:
1. This PR is a substantial refactor of the JDBC client architecture. The previous monolithic JDBC client has been refactored into an abstract base class `JdbcClient`, and a set of database-specific subclasses (e.g., `JdbcMySQLClient`, `JdbcOracleClient`, etc.), and the JdbcClient required config, abstract into an object. This allows for improved modularity, easier addition of support for new databases, and cleaner, more maintainable code. This change is backward-compatible and does not affect existing functionality.
2. As a result of client refactoring, OceanBaseClient can automatically recognize the mode of operation as MySQL or Oracle, so we cancel the oceanbase_mode property in the Jdbc Catalog, but due to the cancellation of the property, When creating a single OceanBase Jdbc Table, the table type needs to be filled in as oceanbase(mysql mode) or oceanbase_oracle(oracle_mode). The above work is a change in the usage behavior, please note.
3. For the PostgreSQL Jdbc Catalog, I did two things:
1. The adaptation to MATERIALIZED VIEW and FOREIGN TABLE is added
2. Fixed reading jsonb, which had been incorrectly changed to json in a previous PR
4. fix some jdbc catalog test case
5. modify oceanbase jdbc doc
And,Thanks @wolfboys for the guidance
This commit is contained in:
@ -251,10 +251,10 @@ properties (
|
||||
"password"="",
|
||||
"jdbc_url" = "jdbc:oceanbase://localhost:2881/test",
|
||||
"driver_url" = "file:///path/to/oceanbase-client-2.4.2.jar",
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver",
|
||||
"oceanbase_mode" = "mysql" or "oracle"
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver"
|
||||
);
|
||||
|
||||
mysql mode
|
||||
CREATE EXTERNAL TABLE `ext_oceanbase` (
|
||||
`k1` int
|
||||
) ENGINE=JDBC
|
||||
@ -263,6 +263,16 @@ PROPERTIES (
|
||||
"table" = "test.test",
|
||||
"table_type"="oceanbase"
|
||||
);
|
||||
|
||||
oracle mode
|
||||
CREATE EXTERNAL TABLE `ext_oceanbase` (
|
||||
`k1` int
|
||||
) ENGINE=JDBC
|
||||
PROPERTIES (
|
||||
"resource" = "jdbc_oceanbase",
|
||||
"table" = "test.test",
|
||||
"table_type"="oceanbase_oracle"
|
||||
);
|
||||
```
|
||||
|
||||
### 9.NebulaGraphTest (only supports queries)
|
||||
|
||||
@ -214,18 +214,7 @@ CREATE CATALOG jdbc_oceanbase_mysql PROPERTIES (
|
||||
"password"="123456",
|
||||
"jdbc_url" = "jdbc:oceanbase://127.0.0.1:2881/demo",
|
||||
"driver_url" = "oceanbase-client-2.4.2.jar",
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver",
|
||||
"oceanbase_mode" = "mysql"
|
||||
)
|
||||
|
||||
CREATE CATALOG jdbc_oceanbase_oracle PROPERTIES (
|
||||
"type"="jdbc",
|
||||
"user"="root",
|
||||
"password"="123456",
|
||||
"jdbc_url" = "jdbc:oceanbase://127.0.0.1:2881/demo",
|
||||
"driver_url" = "oceanbase-client-2.4.2.jar",
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver",
|
||||
"oceanbase_mode" = "oracle"
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver"
|
||||
)
|
||||
```
|
||||
|
||||
@ -240,9 +229,9 @@ CREATE CATALOG jdbc_oceanbase_oracle PROPERTIES (
|
||||
| `driver_class ` | Yes | | JDBC Driver Class |
|
||||
| `only_specified_database` | No | "false" | Whether only the database specified to be synchronized. |
|
||||
| `lower_case_table_names` | No | "false" | Whether to synchronize jdbc external data source table names in lower case. |
|
||||
| `oceanbase_mode` | No | "" | When the connected external data source is OceanBase, the mode must be specified as mysql or oracle |
|
||||
| `include_database_list` | No | "" | When only_specified_database=true,only synchronize the specified databases. split with ','. db name is case sensitive. |
|
||||
| `exclude_database_list` | No | "" | When only_specified_database=true,do not synchronize the specified databases. split with ','. db name is case sensitive. |
|
||||
|
||||
> `driver_url` can be specified in three ways:
|
||||
>
|
||||
> 1. File name. For example, `mysql-connector-java-5.1.47.jar`. Please place the Jar file package in `jdbc_drivers/` under the FE/BE deployment directory in advance so the system can locate the file. You can change the location of the file by modifying `jdbc_drivers_dir` in fe.conf and be.conf.
|
||||
|
||||
@ -163,8 +163,7 @@ CREATE CATALOG [IF NOT EXISTS] catalog_name
|
||||
"password"="",
|
||||
"jdbc_url" = "jdbc:oceanbase://localhost:2881/demo",
|
||||
"driver_url" = "file:///path/to/oceanbase-client-2.4.2.jar",
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver",
|
||||
"oceanbase_mode" = "mysql" or "oracle"
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver"
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
@ -245,10 +245,10 @@ properties (
|
||||
"password"="",
|
||||
"jdbc_url" = "jdbc:oceanbase://localhost:2881/test",
|
||||
"driver_url" = "file:///path/to/oceanbase-client-2.4.2.jar",
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver",
|
||||
"oceanbase_mode" = "mysql" or "oracle"
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver"
|
||||
);
|
||||
|
||||
mysql模式
|
||||
CREATE EXTERNAL TABLE `ext_oceanbase` (
|
||||
`k1` int
|
||||
) ENGINE=JDBC
|
||||
@ -257,6 +257,16 @@ PROPERTIES (
|
||||
"table" = "test.test",
|
||||
"table_type"="oceanbase"
|
||||
);
|
||||
|
||||
oracle模式
|
||||
CREATE EXTERNAL TABLE `ext_oceanbase` (
|
||||
`k1` int
|
||||
) ENGINE=JDBC
|
||||
PROPERTIES (
|
||||
"resource" = "jdbc_oceanbase",
|
||||
"table" = "test.test",
|
||||
"table_type"="oceanbase_oracle"
|
||||
);
|
||||
```
|
||||
|
||||
### 9.Nebula-graph测试 (仅支持查询)
|
||||
|
||||
@ -215,18 +215,7 @@ CREATE CATALOG jdbc_oceanbase_mysql PROPERTIES (
|
||||
"password"="123456",
|
||||
"jdbc_url" = "jdbc:oceanbase://127.0.0.1:2881/demo",
|
||||
"driver_url" = "oceanbase-client-2.4.2.jar",
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver",
|
||||
"oceanbase_mode" = "mysql"
|
||||
)
|
||||
|
||||
CREATE CATALOG jdbc_oceanbase_oracle PROPERTIES (
|
||||
"type"="jdbc",
|
||||
"user"="root",
|
||||
"password"="123456",
|
||||
"jdbc_url" = "jdbc:oceanbase://127.0.0.1:2881/demo",
|
||||
"driver_url" = "oceanbase-client-2.4.2.jar",
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver",
|
||||
"oceanbase_mode" = "oracle"
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver"
|
||||
)
|
||||
```
|
||||
|
||||
@ -241,7 +230,6 @@ CREATE CATALOG jdbc_oceanbase_oracle PROPERTIES (
|
||||
| `driver_class` | 是 | | JDBC Driver Class 名称 |
|
||||
| `only_specified_database` | 否 | "false" | 指定是否只同步指定的 database |
|
||||
| `lower_case_table_names` | 否 | "false" | 是否以小写的形式同步jdbc外部数据源的表名 |
|
||||
| `oceanbase_mode` | 否 | "" | 当连接的外部数据源为OceanBase时,必须为其指定模式为mysql或oracle |
|
||||
| `include_database_list` | 否 | "" | 当only_specified_database=true时,指定同步多个database,以','分隔。db名称是大小写敏感的。 |
|
||||
| `exclude_database_list` | 否 | "" | 当only_specified_database=true时,指定不需要同步的多个database,以','分割。db名称是大小写敏感的。|
|
||||
|
||||
|
||||
@ -167,8 +167,7 @@ CREATE CATALOG [IF NOT EXISTS] catalog_name
|
||||
"password"="",
|
||||
"jdbc_url" = "jdbc:oceanbase://localhost:2881/demo",
|
||||
"driver_url" = "file:///path/to/oceanbase-client-2.4.2.jar",
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver",
|
||||
"oceanbase_mode" = "mysql" or "oracle"
|
||||
"driver_class" = "com.oceanbase.jdbc.Driver"
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user