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
The OBClient application is downloaded and installed. If the OBClient application is not installed, visit Software Center to download and install the corresponding version of OBClient.
Procedure
In the command line, specify the operating parameters of OBClient in the following format:
$ obclient -hxxx.xxx.xxx.xxx -P3306 -u a**** -p****** -AOptions:
Option
Description
-h
The domain name of the OceanBase database to be connected.
-P
The port for connecting to the OceanBase database. By default, the port is 1521 in Oracle mode.
-u
The tenant account.
-p
The account password. For security reasons, you can skip this option. In this 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 command-line prompt appears on the command-line terminal:
obclient [a****]>To exit the OBClient command-line terminal, enter
exitand press Enter, or press Ctrl+D.
Examples
Use the Oracle client to connect to an Oracle tenant of OceanBase:
$ obclient -hxxx.xxx.xxx.xxx -P1521 -ua**** -p****** -AUpon successful logon, the following results are returned:
Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 102073 Server version: OceanBase 3.2.4.2 (…) (Built Feb 27 2023 17:31:19) 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.Check the system time.
obclient [a****]> SELECT SYSDATE FROM dual;Returned result:
+-----------+ | SYSDATE | +-----------+ | 29-MAR-23 | +-----------+ 1 row in setEnter
exitand press Enter to exit.obclient [a****]> exitExecution results:
Bye
References
For more information about how to use OBClient to connect to an Oracle tenant of OceanBase, see Connect to an OceanBase Database tenant by using OBClient.