This section describes how to connect to and access a MySQL tenant of OceanBase Database. Currently, you can connect to an OceanBase database by using a client, a driver, or an Object Relational Mapping (ORM) framework.
Clients
You can use one of the following clients to connect to a MySQL tenant of OceanBase Database:
mysql client
A mysql client is a MySQL CLI tool that must be separately installed.
NoteOceanBase Database tenants include MySQL tenants and Oracle tenants. You can use a mysql client to access only MySQL tenants of OceanBase Database.
After you connect to OceanBase Database, you can run MySQL O&M commands and execute SQL statements in the CLI of a MySQL client for the following purposes:
Calculating, storing, and generating query results
Creating database objects and checking and modifying object definitions
Managing databases and modifying parameters
For more information about how to use a mysql client to connect to a MySQL tenant of OceanBase Database, see Connect to an OceanBase Database tenant by using a MySQL client.
OBClient
OBClient is an interactive and batch query CLI tool that supports both MySQL tenants and Oracle tenants of OceanBase Database. You can visit Software Center to download and install OBClient.
Before you use OBClient to connect to an OceanBase Database tenant, you must specify the connection information of the tenant. After you connect to OceanBase Database, you can use OBClient to run some database commands (including general MySQL commands) and execute some SQL and PL/SQL statements for the following purposes:
Calculating, storing, and generating query results
Creating database objects and checking and modifying object definitions
Developing and running batch processing scripts
Managing databases and modifying parameters
For more information about how to use OBClient to connect to an OceanBase Database tenant, see Connect to an OceanBase Database tenant by using OBClient.
ODC
OceanBase Developer Center (ODC) is an enterprise-level database development platform tailored for OceanBase Database. You can access ODC in the Apsara for OceanBase console.
ODC is compatible with both MySQL and Oracle tenants in OceanBase Database. It provides database developers with various features, such as daily development, WebSQL-based workspace, SQL diagnostics, session management, and data import and export.
For more information about how to use ODC to connect to an OceanBase Database tenant, see Connect to an OceanBase database by using ODC.
Drivers
You can use one of the following drivers to connect to a MySQL tenant of OceanBase Database:
JDBC driver (MySQL Connector/J)
MySQL Connector/J is the official Java Database Connectivity (JDBC) driver provided by MySQL.
For more information about how to use MySQL Connector/J to connect to an OceanBase Database tenant, see Connect to an OceanBase database by using a JDBC driver.
OceanBase Connector/C
OceanBase Connector/C is an OBClient development component based on C/C++. OceanBase Connector/C supports C API libraries.
OceanBase Connector/C allows C/C++ applications to access OceanBase distributed database clusters from the underlying layer. Then, the applications can perform operations such as database connection, data access, error processing, and prepared statement processing.
OceanBase Connector/C is also called LibOBClient. By using OceanBase Connector/C, an application can act as an independent server process to communicate with OBServer nodes over network connections. A client application references the C API header file during compilation and can connect to the C API library file.
NoteThe .so file generated by LibOBClient is
libobclient.so, which corresponds to thelibmysqlclient.sofile in MySQL. An OceanBase database uses OBClient as its CLI tool, which corresponds to the CLI tool in MySQL.For more information about how to use OceanBase Connector/C to connect to an OceanBase database, see Connect to an OceanBase database by using OceanBase Connector/C.
Python drivers
PyMySQL is a library in Python 3.x for connecting to MySQL database servers. PyMySQL follows the Python Database API Specification 2.0 and contains a pure-Python MySQL client library. You can use PyMySQL to connect Python applications to an OceanBase database in MySQL mode.
MySQL-python is a library in Python 2.x for connecting to OceanBase Database.
For more information about how to use a Python driver to connect to an OceanBase database, see Connect to an OceanBase database by using a Python driver.
Go MySQL Driver
Go MySQL Driver is an implementation of the
database/sql/driverinterface in the Go language. You can import the driver to use the fulldatabase/sqlAPI.For more information about how to use Go MySQL Driver to connect to an OceanBase database, see Connect to an OceanBase database by using Go MySQL Driver.
ORM framework
ORM is a programming technique that converts data between databases and systems of different types in object-oriented programming languages. In effect, ORM creates a "virtual object database" that can be used within programming languages.
When you use the ORM framework based on JDBC to connect to a MySQL tenant of OceanBase Database, you can refer to the following documents: