This topic describes how to create a data source in OceanBase Developer Center (ODC).
Background information
ODC allows you to connect to data sources to edit and manage the database objects and resources of connected data sources. ODC can connect to OceanBase Database and OceanBase Cloud in the MySQL compatible and Oracle compatible modes on Apsara Stack and Alibaba Cloud, and OB Sharding MySQL. ODC can also connect to MySQL, Oracle, Doris, and PostgreSQL databases, as well as object storage services, such as Alibaba Cloud Object Storage Service (OSS), Tencent Cloud Object Storage (COS), Huawei Cloud Object Storage Service (OBS), and Amazon Simple Storage Service (S3).
Prerequisites
For information about the functional limitations and version requirements on data sources, see Limitations.
You have entered the data source management page.
You have obtained the connection information or connection string of the data source instance. The connection string of a MySQL-compatible tenant of OceanBase Database is in the following format:
mysql -h host name -P port number -u database username@tenant name # cluster name -D default database -p 'database password'
-hxxx.x.x.x -P8080 -uodc@mysql_tenant#odc_cluster -Dodc -p'******'
Procedure
Create an OceanBase data source
Example: Create an OceanBase data source in the MySQL compatible mode named obmysql4.3.x in ODC.
After the OceanBase Cloud console, enter the Web ODC. In the left-side navigation pane of the project collaboration window, choose Data Sources > Create Data Source > OceanBase MySQL.
In the Create Data Source panel, specify the following information.
Parameter Description Endpoint Select a database instance, including cluster instance and tenant instance. Database Account - Database User Name: the username of an account created in the tenant. In the MySQL compatible mode, this account must have the permission to access the default database.
- Database Password: the password of the account created in the tenant. You can click Test Connection next to the password field to test whether you can connect to the target database.
Environment The type of the environment. Valid values: dev (development), sit (system integration test), and prod (production). Project You can choose to bind the created data source to the specified project. After the data source is bound to the project, the databases created in the data source are automatically moved to the project. Note
The system parameterodc.connect.database.sync.block-internal-databasespecifies whether to automatically synchronize built-in databases to the project. The default value is true, which specifies not to automatically synchronize built-in databases to the bound project. The built-in databases identified by ODC for different data sources are as follows:- OceanBase Oracle:
SYS - OceanBase MySQL:
information_schema,mysql,test, andoceanbase - MySQL:
information_schema,mysql, andtest.
Advanced Settings Startup Script: You can configure a connection session by using an SQL statement, such as set session ob_query_timeout=60000000.After you specify the preceding information, click OK in the lower-right corner of the panel.
In the dialog box that appears, enter the data source name and click OK. The data source is then saved to the data source list of ODC.
After the data source is created, you can view the created data source in the data source list.