OceanBase Developer Center (ODC) allows you to connect to an Oracle tenant of OceanBase Database. This topic describes how to connect to OceanBase Database by using ODC.
Prerequisites
You have downloaded and installed the ODC client.
Procedure
This topic provides an example of creating a private connection by using an ODC client. The procedure is as follows:
Open the ODC client.
On the Private Connections tab of the homepage, click Create Connection in the upper-right corner to create a private connection.
Note
When you run ODC for the first time, the loading time may take a bit longer than usual.
Specify the following parameters in the Create Private Connection dialog box. If you have an OceanBase Database connection string, which is in the format of
mysql -h <host name> -P <port number> -u <database username@tenant name> # <cluster name> -D <default database> -p '<database password>', you can obtain the information directly from the string. You can also paste the string in the field of Intelligent Parsing in the dialog box to automatically populate these parameters.Parameter Description Database Type Select Physical Database. Valid values: - Physical Database: regular databases.
- Logical Database: ODP (Sharding).
Region Select Independent Deployment/ApsaraStack. Connection Name Specify the name of the connection. Set Tag You can add some descriptive information for the connection.
Click the Set Tag button after Connection Name to set a tag for the current connection. You can set and manage tags in the drop-down list that appears.- Tag setting: Select a tag from the drop-down list. Create tags first if the list is empty.
- Tag management: Click Create Tag at the bottom of the list or the settings icon above the list to go to the Tags page, where you can edit or delete created tags. You can also click Create Tag to set a name or color for the new tag.
Intelligent Parsing You can paste a connection string to the text box. ODC automatically identifies the string and fills in the corresponding value. Connection Mode Select Oracle. Logical databases support only the MySQL mode. Endpoint - Host IP: the IP address of the server where the target database is located.
- Port: the port number of the server where the target database is located.
- Cluster: the name of the cluster where the target database is located. This parameter is not required for logical databases.
- Tenant: the name of the tenant in which the target database is located. This parameter is not required for logical databases.
Note
You can obtain the host name and port number from the details page of the tenant in which the target database is located, such as a tenant created on Alibaba Cloud or in OceanBase Cloud Platform (OCP).
Database Account - Database Username: the username of an account created in the tenant.
- Database Password: the password of an account created in the tenant. You can click Test Connection next to the password box to test whether you can connect to the target database.
- Save Password: If you deselect this option, the database password will not be saved to the connection information. Each time you access or test the connection, you must enter the database password in the pop-up password window. If you select this option, the database password will be saved to the connection information. You do not need to enter the database password when you access the connection again.
Note
- An error will be returned if the configurations such as the username, password, and network settings are invalid.
- You can only connect to a database in the current tenant. Otherwise, a test failure error will be returned.
- In ODC V4.0.0 and later, you can save the connection without entering the database account and password.
SQL Query Timeout Value You can specify a timeout value for SQL queries. A query whose execution time exceeds the timeout value is automatically terminated. The default timeout value is 60 seconds. sys Tenant Account Settings Choose whether to select Query Tenant Views with sys Tenant Account. If you select this option, specify Account and Password.
When Database Type is set to Physical Database, you can specify an account that has the privilege to querysystenant views, and the password. The account and password are automatically populated whensysis specified as the tenant in Endpoint.- Account: an account that has the privilege to check the views under the
systenant. - Password: the password of the account.
Note
- In ODC V2.3.0 and later, to use the import and export features, you need to configure the
root@sysaccount in the Advanced Configuration section during connection creation. - In ODC V2.4.1 and later, the strong dependency on the
root@sysaccount is removed when you query views for import or export. If theroot@sysaccount is not configured, some ODC objects such as stored procedures and functions do not support the export feature. If theroot@sysaccount is configured, you can access the views under thesystenant to obtain the optimal data routing strategy, which can increase the export speed. - The account and password of the
systenant are the account and password of a user in a tenant of the cluster. Do not enter@sys#clusterin the Account field. For example, the account can beroot.
Click Save to save the current configuration in the ODC connection list. When you log in to ODC the next time, you can directly select the connection from the list. The connection configuration does not necessarily need to pass the connection test when you save the configuration.
Note
Before you save the configuration, you can click Test Connection to test the database connection. If the username and password are correct, the system returns a message indicating that the connection succeeded.
References
For more information about other features of ODC, see the ODC documentation in OceanBase Documentation Center.