Configure an ApsaraDB for OceanBase instance as a DataWorks data source to read from and write to OceanBase databases in your pipelines.
-
Data source type:
apsaradb_for_oceanbase -
Supported configuration modes (`ConnectionPropertiesMode`): instance mode (
InstanceMode), connection string mode (UrlMode)
Choose a connection mode
| Mode | When to use |
|---|---|
| Current-account instance mode | Your OceanBase cluster is in the same Alibaba Cloud account as DataWorks. This is the most common setup. |
| Cross-account instance mode | Your OceanBase cluster belongs to a different Alibaba Cloud account. Requires a RAM role that grants cross-account access. |
| Connection string mode | Your OceanBase instance is self-managed, or you need to connect using a direct host and port. Supports both MySQL and Oracle compatibility modes. |
Property definition
Current-account instance mode
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
regionId |
String | Yes | cn-shanghai |
The ID of the region where the instance is located. |
instanceId |
String | Yes | ob5nj51ns6qjr4 |
The ID of the ApsaraDB for OceanBase cluster instance. |
tenant |
String | Yes | t5nnecr8dppi8 |
The ID of the ApsaraDB for OceanBase tenant. |
database |
String | Yes | ob_database |
The name of the database. |
username |
String | Yes | xxxxx |
The username. |
password |
String | Yes | xxxxx |
The password. |
readOnlyDBInstance |
String | No | t62zwpvyehmps-ro0.cn-beijing.oceanbase.aliyuncs.com:1521 |
The address of the read-only instance. |
envType |
String | Yes | Dev |
The environment type. Valid values: Dev (development environment), Prod (production environment). |
Cross-account instance mode
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
regionId |
String | Yes | cn-shanghai |
The ID of the region where the instance is located. |
instanceId |
String | Yes | ob5nj51ns6qjr4 |
The ID of the ApsaraDB for OceanBase cluster instance. |
tenant |
String | Yes | t5nnecr8dppi8 |
The ID of the ApsaraDB for OceanBase tenant. |
database |
String | Yes | ob_database |
The name of the database. |
username |
String | Yes | xxxxx |
The username. |
password |
String | Yes | xxxxx |
The password. |
crossAccountOwnerId |
String | Yes | 1 |
The ID of the other Alibaba Cloud account. |
crossAccountRoleName |
String | Yes | cross-role |
The name of the RAM role that the other Alibaba Cloud account assumes. |
readOnlyDBInstance |
String | No | t62zwpvyehmps-ro0.cn-beijing.oceanbase.aliyuncs.com:1521 |
The address of the read-only instance. |
envType |
String | Yes | Dev |
The environment type. Valid values: Dev (development environment), Prod (production environment). |
Connection string mode
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
dbMode |
String | No | mysql |
The compatibility mode of the OceanBase tenant. Valid values: mysql, oracle. |
address |
Array | Yes | [{"host": "127.0.0.1", "port": 3306}] |
The host address and port number of the OceanBase instance. |
database |
String | Yes | ob_database |
The name of the database. |
username |
String | Yes | xxxxx |
The username. |
password |
String | Yes | xxxxx |
The password. |
properties |
JSON Object | No | {"useSSL": "false"} |
Additional JDBC driver properties. |
envType |
String | Yes | Dev |
The environment type. Valid values: Dev (development environment), Prod (production environment). |
Configuration examples
Current-account instance mode
{
"envType": "Prod",
"instanceId": "obxxxxxxxxxx",
"tenant": "txxxxxxxxxx",
"regionId": "cn-shanghai",
"database": "db",
"username": "aliyun",
"password": "xxx"
}
Cross-account instance mode
The cross-account mode requires two additional parameters: crossAccountOwnerId to identify the target Alibaba Cloud account, and crossAccountRoleName to specify the RAM role used for access.
{
"envType": "Prod",
"instanceId": "obxxxxxxxxxx",
"tenant": "txxxxxxxxxx",
"regionId": "cn-shanghai",
"database": "db",
"username": "aliyun",
"password": "xxx",
"crossAccountOwnerId": "1234567890",
"crossAccountRoleName": "my_ram_role"
}
Connection string mode
Use address to specify the host and port directly. Set dbMode to match your OceanBase tenant's compatibility mode (mysql or oracle).
{
"envType": "Prod",
"address": [
{
"host": "127.0.0.1",
"port": "5432"
}
],
"dbMode": "mysql",
"database": "db",
"properties": {
"connectTimeout": "2000"
},
"username": "aliyun",
"password": "xxx"
}
该文章对您有帮助吗?