> For the complete documentation index, see [llms.txt](https://docs.selfuel.digital/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.selfuel.digital/data-integration-with-nexus/nexus-elements/connectors/source/oceanbase.md).

# OceanBase

> JDBC OceanBase Source Connector

### Key Features[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#key-features) <a href="#key-features" id="key-features"></a>

* [x] &#x20;batch
* [ ] &#x20;stream
* [x] &#x20;exactly-once
* [x] &#x20;column projection
* [x] &#x20;parallelism
* [x] &#x20;support user-defined split

### Description[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#description) <a href="#description" id="description"></a>

Read external data source data through JDBC.

### Data Type Mapping[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#data-type-mapping) <a href="#data-type-mapping" id="data-type-mapping"></a>

#### Mysql Mode[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#mysql-mode) <a href="#mysql-mode" id="mysql-mode"></a>

| Mysql Data type                                                                               | Nexus Data type                                                                                                                                           |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>BIT(1)<br>TINYINT(1)</p>                                                                   | BOOLEAN                                                                                                                                                   |
| TINYINT                                                                                       | BYTE                                                                                                                                                      |
| <p>TINYINT<br>TINYINT UNSIGNED</p>                                                            | SMALLINT                                                                                                                                                  |
| <p>SMALLINT UNSIGNED<br>MEDIUMINT<br>MEDIUMINT UNSIGNED<br>INT<br>INTEGER<br>YEAR</p>         | INT                                                                                                                                                       |
| <p>INT UNSIGNED<br>INTEGER UNSIGNED<br>BIGINT</p>                                             | BIGINT                                                                                                                                                    |
| BIGINT UNSIGNED                                                                               | DECIMAL(20,0)                                                                                                                                             |
| DECIMAL(x,y)(Get the designated column's specified column size.<38)                           | DECIMAL(x,y)                                                                                                                                              |
| DECIMAL(x,y)(Get the designated column's specified column size.>38)                           | DECIMAL(38,18)                                                                                                                                            |
| DECIMAL UNSIGNED                                                                              | <p>DECIMAL((Get the designated column's specified column size)+1,<br>(Gets the designated column's number of digits to right of the decimal point.)))</p> |
| <p>FLOAT<br>FLOAT UNSIGNED</p>                                                                | FLOAT                                                                                                                                                     |
| <p>DOUBLE<br>DOUBLE UNSIGNED</p>                                                              | DOUBLE                                                                                                                                                    |
| <p>CHAR<br>VARCHAR<br>TINYTEXT<br>MEDIUMTEXT<br>TEXT<br>LONGTEXT<br>JSON<br>ENUM</p>          | STRING                                                                                                                                                    |
| DATE                                                                                          | DATE                                                                                                                                                      |
| TIME                                                                                          | TIME                                                                                                                                                      |
| <p>DATETIME<br>TIMESTAMP</p>                                                                  | TIMESTAMP                                                                                                                                                 |
| <p>TINYBLOB<br>MEDIUMBLOB<br>BLOB<br>LONGBLOB<br>BINARY<br>VARBINAR<br>BIT(n)<br>GEOMETRY</p> | BYTES                                                                                                                                                     |

#### Oracle Mode[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#oracle-mode) <a href="#oracle-mode" id="oracle-mode"></a>

| Oracle Data type                                                                                  | Nexus Data type   |
| ------------------------------------------------------------------------------------------------- | ----------------- |
| Integer                                                                                           | DECIMAL(38,0)     |
| Number(p), p <= 9                                                                                 | INT               |
| Number(p), p <= 18                                                                                | BIGINT            |
| Number(p), p > 18                                                                                 | DECIMAL(38,18)    |
| Number(p,s)                                                                                       | DECIMAL(p,s)      |
| Float                                                                                             | DECIMAL(38,18)    |
| <p>REAL<br>BINARY\_FLOAT</p>                                                                      | FLOAT             |
| BINARY\_DOUBLE                                                                                    | DOUBLE            |
| <p>CHAR<br>NCHAR<br>VARCHAR<br>VARCHAR2<br>NVARCHAR2<br>NCLOB<br>CLOB<br>LONG<br>XML<br>ROWID</p> | STRING            |
| DATE                                                                                              | TIMESTAMP         |
| <p>TIMESTAMP<br>TIMESTAMP WITH LOCAL TIME ZONE</p>                                                | TIMESTAMP         |
| <p>BLOB<br>RAW<br>LONG RAW<br>BFILE</p>                                                           | BYTES             |
| UNKNOWN                                                                                           | Not supported yet |

### Source Options[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#source-options) <a href="#source-options" id="source-options"></a>

| Name                            | Type       | Required | Default         | Description                                                                                                                                                                                                                                                          |
| ------------------------------- | ---------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| url                             | String     | Yes      | -               | The URL of the JDBC connection. Refer to a case: jdbc:oceanbase://localhost:2883/test                                                                                                                                                                                |
| driver                          | String     | Yes      | -               | The jdbc class name used to connect to the remote data source, should be `com.oceanbase.jdbc.Driver`.                                                                                                                                                                |
| user                            | String     | No       | -               | Connection instance user name                                                                                                                                                                                                                                        |
| password                        | String     | No       | -               | Connection instance password                                                                                                                                                                                                                                         |
| compatible\_mode                | String     | Yes      | -               | The compatible mode of OceanBase, can be 'mysql' or 'oracle'.                                                                                                                                                                                                        |
| query                           | String     | Yes      | -               | Query statement                                                                                                                                                                                                                                                      |
| connection\_check\_timeout\_sec | Int        | No       | 30              | The time in seconds to wait for the database operation used to validate the connection to complete                                                                                                                                                                   |
| partition\_column               | String     | No       | -               | The column name for parallelism's partition, only support numeric type column and string type column.                                                                                                                                                                |
| partition\_lower\_bound         | BigDecimal | No       | -               | The partition\_column min value for scan, if not set Nexus will query database get min value.                                                                                                                                                                        |
| partition\_upper\_bound         | BigDecimal | No       | -               | The partition\_column max value for scan, if not set Nexus will query database get max value.                                                                                                                                                                        |
| partition\_num                  | Int        | No       | job parallelism | The number of partition count, only support positive integer. Default value is job parallelism.                                                                                                                                                                      |
| fetch\_size                     | Int        | No       | 0               | <p>For queries that return a large number of objects, you can configure<br>the row fetch size used in the query to improve performance by<br>reducing the number database hits required to satisfy the selection criteria.<br>Zero means use jdbc default value.</p> |
| properties                      | Map        | No       | -               | <p>Additional connection configuration parameters,when properties and URL have the same parameters, the priority is determined by the<br>specific implementation of the driver. For example, in MySQL, properties take precedence over the URL.</p>                  |
| common-options                  |            | No       | -               | Source plugin common parameters, please refer to [Source Common Options](/data-integration-with-nexus/nexus-elements/connectors/source/source-common-options.md) for details                                                                                         |

#### Tips[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#tips) <a href="#tips" id="tips"></a>

> If partition\_column is not set, it will run in single concurrency, and if partition\_column is set, it will be executed in parallel according to the concurrency of tasks.

### Task Example[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#task-example) <a href="#task-example" id="task-example"></a>

#### Simple:[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#simple) <a href="#simple" id="simple"></a>

```
env {
  parallelism = 2
  job.mode = "BATCH"
}

source {
  Jdbc {
    driver = "com.oceanbase.jdbc.Driver"
    url = "jdbc:oceanbase://localhost:2883/test?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true"
    user = "root"
    password = ""
    compatible_mode = "mysql"
    query = "select * from source"
  }
}

transform {
    # If you would like to get more information about how to configure Nexus and see full list of transform plugins,
    # please go to transform page
}

sink {
    Console {}
}
```

#### Parallel:[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#parallel) <a href="#parallel" id="parallel"></a>

> Read your query table in parallel with the shard field you configured and the shard data. You can do this if you want to read the whole table

```
env {
  parallelism = 10
  job.mode = "BATCH"
}
source {
  Jdbc {
    driver = "com.oceanbase.jdbc.Driver"
    url = "jdbc:oceanbase://localhost:2883/test?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true"
    user = "root"
    password = ""
    compatible_mode = "mysql"
    query = "select * from source"
    # Parallel sharding reads fields
    partition_column = "id"
    # Number of fragments
    partition_num = 10
  }
}
sink {
  Console {}
}
```

#### Parallel Boundary:[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OceanBase#parallel-boundary) <a href="#parallel-boundary" id="parallel-boundary"></a>

> It is more efficient to read your data source according to the upper and lower boundaries you configured

```
source {
  Jdbc {
    driver = "com.oceanbase.jdbc.Driver"
    url = "jdbc:oceanbase://localhost:2883/test?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true"
    user = "root"
    password = ""
    compatible_mode = "mysql"
    query = "select * from source"
    partition_column = "id"
    partition_num = 10
    # Read start boundary
    partition_lower_bound = 1
    # Read end boundary
    partition_upper_bound = 500
  }
}
```
