This topic describes how to create a database connection in OceanBase Developer Center (ODC).
Background
As an enterprise-level database development platform tailored for OceanBase Database, ODC can connect to your OceanBase Database, and allow you to edit and manage the database objects and resources. After you install client ODC or deploy web ODC, you must create database connections. ODC can connect to OceanBase Database in MySQL and Oracle modes on Apsara Stack and Alibaba Cloud.
Prerequisites
Client ODC has been installed or web ODC has been deployed. For the deployment of web ODC, contact your technical support personnel. For the installation of client ODC, see Install ODC.
If you are using web ODC, you have logged to ODC and entered the connection management page. For more information, see Log on to the database.
The connection information or connection string of the target instance has been obtained. The connection string of the example connection in this topic is as follows:
-hxxx.x.x.x -P8080 -uodc@oracle_tenant#odc_cluster -Dodc -p'Password01'
Procedure
On the Connections tab of the ODC homepage, click Create Connection go to the Create Connection panel.
Specify Region for the connection. The region is where the connected instance is located. The following options are available:
Public Cloud : the database instance deployed on Alibaba Cloud.
Independent Deployment/Apsara Stack : the database instance in your own environment. In this example, select Apsara Stack.
Specify Connection Mode .
OceanBase Database supports instances in MySQL and Oracle modes. In this example, Oracle is selected because the sample instance in this topic is in Oracle mode.
Specify Connection Name .
The connection name uniquely identifies the connection. You need to specify a unique connection name. The sample connection is named Connection_Tutorial.
Use intelligent DNS resolution.
If you have the connection string of the connected instance, you can paste the connection string to the Intelligent DNS Resolution field. After you click Intelligent DNS Resolution , ODC automatically resolves the string and specifies the parameters such as Endpoint , Default Database , Database Username , and Database Password . If you do not have the connection string, you can skip this step and start from Step 6 to manually enter the preceding information.
Specify Endpoint .
The endpoint contains the following information:
Host Name : the IP address of the server where the target instance is located. If your instance is located on Alibaba Cloud, you can get the host name from the tenant information page of the Alibaba Cloud Management Console. The IP address of the sample instance is xxx.x.x.x.
Port : the port number of the server where the target instance is located. If your instance is on Alibaba Cloud, you can get the port number from the tenant information page of the Alibaba Cloud Management Console. The port number of the sample instance is 8080.
Cluster : the name of the cluster where the target instance is located. In this example, the cluster name is odc_cluster.
Tenant : the name of the tenant to which the target instance belongs. The tenant name of the sample instance is oracle_tenant.
Specify Default Database .
When you connect ODC to a database in a MySQL tenant, you can choose to specify a default database for the connection. This parameter does not need to be specified when you connect ODC to a database in an Oracle tenant. This parameter is optional. If you do not set this parameter, the default database instance information_schema is used.
Specify Database Username .
The database username is the name of a user created in a tenant. In Oracle mode, the username is the same as the schema name. In MySQL mode, the corresponding user of the username must access to the default database. The database username of the sample instance is odc.
Specify Database Password .
Specify the password corresponding to the database username specified in Step 8. The database password of the sample instance is Password01.
Click Test Connection .
After you specify Database Password , you can click Test Connection to check whether ODC is connected to the target instance based on the preceding connection information. The connection status does not affect the saving of the connection information.
Specify whether to disable Save Database Password .
If you disable this option, the database password for the connection is not saved. Each time you use or test a connection, you must enter the database password in the password dialog box to use the connection. If you enable this option, the database password for the connection is saved. You do not need to enter the database password each time you use the connection.
Specify SQL Query Timeout Value in Advanced Configuration .
ODC allows you to specify a custom SQL query timeout value, which is 60s by default. When the execution time of a query reaches the specified value, the query automatically terminates. In ODC V2.3.2 and later, transactions need to be manually committed. In earlier versions, transactions are automatically committed. In manual commit mode, the value of the
ob_trx_idle_timeoutvariable cannot be less than the SQL query timeout value. If two SQL queries in one transaction are executed at an interval exceeding the value ofob_trx_idle_timeout, the connection will be terminated. However, ifob_trx_idle_timeoutis set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you need to set this parameter to a proper value.Specify Query SYS Tenant View in Advanced Configuration .
You can specify the account that have the permission to query views of the sys tenant and the corresponding password. In ODC V2.3.0 and later versions, to use the import and export features and check the partition information, you need to configure the root@sys account, that is, the root account under the sys tenant, by using this option. By default, the password for the root@sys account of the sample instance is null, so you only need to set Account to root. After you specify Account, you can click Test Connection to test whether you can use the root@sys account to access the current database.
Click Save to save the connection information.
After you configure all the preceding connection information, click Save in the lower-right corner to save the settings in the current Create Connection page. Then, the information appears on the Connections tab of the ODC homepage. You can directly find the target connection on the Connections tab and click the name of the connection to enter the connected instance in the future.