OceanBase Client (OBClient) is a command-line interface (CLI) tool dedicated to OceanBase Database. You can use it to connect to two types of OceanBase Database tenants: MySQL tenants and Oracle tenants. This topic describes the prerequisites and connection procedure.
Prerequisites
Contact OceanBase Technical Support to obtain the installation package of OBClient and install it correctly.
Procedure
Open a command-line terminal.
Specify the operating parameters of OBClient in the following format:
$obclient -h10.0.0.0 -P2881 -usys@Oracle -p_**1***_ -ANote
Parameters:
-h: specifies the IP address for connecting to OceanBase Database, which is usually the IP address of an ODP.
-u: specifies a tenant account in the Username@Tenant name#Cluster name or Cluster name:Tenant name:Username format. The default administrator username of an Oracle tenant is SYS.
-P: specifies the OceanBase Database connection port, which is also the listening port of ODP. The default value is 2883. You can customize the value as needed.
-p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
-A: specifies not to retrieve the information of all tables to ensure a quick logon when you connect to OceanBase Database.
After successful connection, the following default OBClient command-line prompt appears on the command-line terminal:
obclient>To exit the OBClient command line, enter Exit and press Enter, or press the shortcut key Ctrl+D.
Examples
Use OBClient to connect to an Oracle tenant of OceanBase Database:
$obclient -h10.0.0.0 -P2881 -usys@Oracle -p_**1***_ -A
obclient: [Warning] Using a password on the command line interface can be insecure.
Welcome to the OceanBase monitor. Commands end with ; or \g.
Your OceanBase connection id is 3221688068
Server version: 5.7.25 OceanBase 3.2.1 (...) (Built Sep 30 2021 19:59:46)
<Omitted>
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient> SELECT SYSDATE FROM DUAL;
+-----------+
| SYSDATE |
+-----------+
| 22-OCT-21 |
+-----------+
1 row in set
obclient> exit
Bye