title: “OceanBase catalog” slug: /jdbc-oceanbase-catalog keywords:
import Tabs from ‘@theme/Tabs’; import TabItem from ‘@theme/TabItem’;
Apache Gravitino provides the ability to manage OceanBase metadata.
:::caution Gravitino saves some system information in schema and table comment, like (From Gravitino, DO NOT EDIT: gravitino.v1.uid1078334182909406185)
, please don't change or remove this message. :::
You can pass to a OceanBase data source any property that isn't defined by Gravitino by adding gravitino.bypass.
prefix as a catalog property. For example, catalog property gravitino.bypass.maxWaitMillis
will pass maxWaitMillis
to the data source property.
Check the relevant data source configuration in data source properties
If you use a JDBC catalog, you must provide jdbc-url
, jdbc-driver
, jdbc-user
and jdbc-password
to catalog properties. Besides the common catalog properties, the OceanBase catalog has the following properties:
Configuration item | Description | Default value | Required | Since Version |
---|---|---|---|---|
jdbc-url | JDBC URL for connecting to the database. For example, jdbc:mysql://localhost:2881 or jdbc:oceanbase://localhost:2881 | (none) | Yes | 0.7.0-incubating |
jdbc-driver | The driver of the JDBC connection. For example, com.mysql.jdbc.Driver or com.mysql.cj.jdbc.Driver or com.oceanbase.jdbc.Driver . | (none) | Yes | 0.7.0-incubating |
jdbc-user | The JDBC user name. | (none) | Yes | 0.7.0-incubating |
jdbc-password | The JDBC password. | (none) | Yes | 0.7.0-incubating |
jdbc.pool.min-size | The minimum number of connections in the pool. 2 by default. | 2 | No | 0.7.0-incubating |
jdbc.pool.max-size | The maximum number of connections in the pool. 10 by default. | 10 | No | 0.7.0-incubating |
:::caution Before using the OceanBase Catalog, you must download the corresponding JDBC driver to the catalogs/jdbc-oceanbase/libs
directory. Gravitino doesn't package the JDBC driver for OceanBase due to licensing issues. :::
The OceanBase catalog includes driver version compatibility checks for datetime precision calculation:
null
with a warning logThis limitation affects the following datetime types:
TIME(p)
- time precisionTIMESTAMP(p)
- timestamp precisionDATETIME(p)
- datetime precisionWhen using an unsupported driver version, the system will:
null
for precision calculations to avoid incorrect resultsExample warning log:
WARN: MySQL driver version mysql-connector-java-8.0.11 is below 8.0.16, columnSize may not be accurate for precision calculation. Returning null for TIMESTAMP type precision. Driver version: mysql-connector-java-8.0.11
Recommended driver versions:
mysql-connector-java-8.0.16
or highercom.oceanbase.jdbc.Driver
(OceanBase official driver)Refer to Manage Relational Metadata Using Gravitino for more details.
Refer to Manage Relational Metadata Using Gravitino for more details.
Gravitino Type | OceanBase Type |
---|---|
Byte | Tinyint |
Byte(false) | Tinyint Unsigned |
Short | Smallint |
Short(false) | Smallint Unsigned |
Integer | Int |
Integer(false) | Int Unsigned |
Long | Bigint |
Long(false) | Bigint Unsigned |
Float | Float |
Double | Double |
String | Text |
Date | Date |
Time[(p)] | Time[(p)] |
Timestamp_tz[(p)] | Timestamp[(p)] |
Timestamp[(p)] | Datetime[(p)] |
Decimal | Decimal |
VarChar | VarChar |
FixedChar | FixedChar |
Binary | Binary |
:::info OceanBase doesn't support Gravitino Boolean
Fixed
Struct
List
Map
IntervalDay
IntervalYear
Union
UUID
type. Meanwhile, the data types other than listed above are mapped to Gravitino External Type that represents an unresolvable data type since 0.6.0-incubating. :::
:::note OceanBase setting an auto-increment column requires simultaneously setting a unique index; otherwise, an error will occur. :::
{ "columns": [ { "name": "id", "type": "integer", "comment": "id column comment", "nullable": false, "autoIncrement": true }, { "name": "name", "type": "varchar(500)", "comment": "name column comment", "nullable": true, "autoIncrement": false } ], "indexes": [ { "indexType": "primary_key", "name": "PRIMARY", "fieldNames": [["id"]] } ] }
Column[] cols = new Column[] { Column.of("id", Types.IntegerType.get(), "id column comment", false, true, null), Column.of("name", Types.VarCharType.of(500), "Name of the user", true, false, null) }; Index[] indexes = new Index[] { Indexes.of(IndexType.PRIMARY_KEY, "PRIMARY", new String[][]{{"id"}}) }
{ "indexes": [ { "indexType": "primary_key", "name": "PRIMARY", "fieldNames": [["id"]] }, { "indexType": "unique_key", "name": "id_name_uk", "fieldNames": [["id"] ,["name"]] } ] }
Index[] indexes = new Index[] { Indexes.of(IndexType.PRIMARY_KEY, "PRIMARY", new String[][]{{"id"}}), Indexes.of(IndexType.UNIQUE_KEY, "id_name_uk", new String[][]{{"id"} , {"name"}}), }
:::note The OceanBase catalog does not support creating partitioned tables in the current version. :::
Refer to Manage Relational Metadata Using Gravitino for more details.
Gravitino supports these table alteration operations:
RenameTable
UpdateComment
AddColumn
DeleteColumn
RenameColumn
UpdateColumnType
UpdateColumnPosition
UpdateColumnNullability
UpdateColumnComment
UpdateColumnDefaultValue
SetProperty
:::info
RenameTable
operation at the same time as other operations.