OceanBase Client (OBClient) is a 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 CLI 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 OBProxy.
- -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 port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
- -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 the connection is created, the following default OBClient CLI prompt appears on the CLI 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