This topic describes how to connect to a tenant in Oracle compatible mode of OceanBase Database by using OBClient, including the prerequisites, procedure, and an example.
Prerequisites
- You have downloaded and installed the OBClient application.
- You have obtained the connection string for the target tenant in Oracle compatible mode from the OceanBase Cloud instance. For more information, see Get a connection string.
Procedure
Open a command-line terminal locally.
Run the following command to connect to the target tenant in Oracle mode under the OceanBase Cloud instance, using the connection string obtained in the Prerequisites section.
obclient -h ********.oceanbase.cloud -P 1521 -u ***** -D ***** -pParameter description:
-h: The connection address of the OceanBase Cloud database.-P: The connection port of the OceanBase Cloud database.-u: The name of the database account.-D: The name of the database to be accessed.-p: The password of the account.Note
For security, specify `-p` without a password value and enter the password when prompted. This keeps the password out of command-line arguments and shell history.
Example output:
Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 21 Server version: OceanBase 4.3.2.0 (r200000272024061717-93c0ed73ebbcac6edbf7b585860b75d825935358) (Built Jun 17 2024 18:06:04) Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. obclient [TEST_USER001]>To exit the OBClient command line, type
exitand press Enter, or use the shortcut key Ctrl + D.