This topic describes how to connect to and use a database in a Flagship Edition cluster instance.
Prerequisites
- You have created a Flagship Edition cluster instance. For more information, see Create a cluster instance.
- You have created a tenant. For more information, see Create a tenant.
- You have completed the application and network configurations, such as configuring a public endpoint allowlist and outbound rules or a private endpoint.
Create an account
Before connecting to the database, you must create a database account:
Log in to the OceanBase Cloud console.
In the left-side navigation pane, click Instances.
In the instance list, find the target Flagship Edition cluster instance and click its name to enter the cluster instance workspace.
In the left-side navigation pane, click Tenants.
Find the target tenant and click its name to enter the tenant workspace.
In the left-side navigation pane, click Accounts.
Click Create Account and specify the account name, password, authorized database, and other information.
Click Create to complete the account creation.
Import and query data
On the instance list page, click the instance name to go to the instance workspace. Click the More icon next to the instance, and then click Load Sample Data. Under Benchmarking, select the TPC-H sample dataset and the database that you created, and then click Import.
Go to the SQL Console page.
Select the account you created and enter the password to log in. Click OK.
The
information_schemadatabase is opened by default. In the database list on the left, click the database that you created, such asdefault_database, to open a new SQL window.Execute the following SQL statement to view customers in the
customertable.SELECT * FROM customer;Click
to execute the SQL statement. The Execution Records tab displays all customer information from the customer table.Execute the following SQL statement to filter customers based on specific conditions. For example, generate a list of customers whose birthday month is December.
SELECT * FROM customer WHERE c_birth_month = '12';Click
to execute the SQL statement. The corresponding results are displayed on the Execution Records tab.You can enter different SQL statements at any time to develop and use the database through the SQL console.
