This topic describes how to connect to and access OceanBase Database in MySQL mode. Currently, you can connect to OceanBase Database by using a client, GUI, driver, Object Relational Mapping (ORM) framework, or connection pool.
Connect to OceanBase Database by using a client
You can connect to a MySQL tenant of OceanBase Database by using the following clients:
MySQL client (mysql)
The mysql client is a MySQL command-line interface (CLI) tool that must be separately installed. OceanBase Database supports MySQL tenants and Oracle tenants. You can use the mysql client to access a MySQL tenant.
After you connect to OceanBase Database, you can execute MySQL O&M commands and SQL statements on the mysql command line for the following purposes:
Calculating, storing, and generating query results
Creating database objects, checking and modifying object definitions
Managing databases and modifying parameters
For more information about how to connect to a MySQL tenant of OceanBase Database by using the mysql client, see Connect to an OceanBase tenant by using the mysql client.
OceanBase Client (OBClient)
OBClient is an interactive query tool that supports batch processing and requires separate installation. It provides a CLI and serves as a client for connecting to either a MySQL tenant or an Oracle tenant in OceanBase Database.
Before using OBClient to connect to an OceanBase tenant, you need to provide the tenant's connection details. Once connected to OceanBase Database, OBClient allows you to execute various database commands, including standard MySQL commands as well as SQL and PL/SQL statements, for the following purposes:
Calculating, storing, and generating query results
Creating database objects, checking and modifying object definitions
Developing and running batch processing scripts
Managing databases and modifying parameters
For more information about how to connect to an OceanBase tenant by using OBClient, see Connect to an OceanBase tenant by using OBClient.
OceanBase Developer Center (ODC)
ODC is an enterprise-level database development platform tailored for OceanBase Database.
ODC supports connections to both MySQL and Oracle tenants within OceanBase Database. It offers a range of features for database developers, including routine development tasks, WebSQL, SQL diagnostics, session management, and data import/export capabilities.
For more information about how to connect to an OceanBase tenant by using ODC, see Connect to OceanBase Database by using ODC.
Connect to OceanBase Database by using the GUI
DBeaver
DBeaver is a general-purpose database client that connects to databases using JDBC drivers provided by various database systems. It supports a wide range of databases, including relational, non-relational, and distributed databases.
For more information, see Connect to OceanBase Database by using DBeaver.
Navicat
Similar to DBeaver, Navicat is a general-purpose database client that connects to databases using JDBC drivers provided by various database systems. It also supports a wide range of databases, including relational, non-relational, and distributed databases.
For more information, see Connect to OceanBase Database by using Navicat.
Connect to OceanBase Database by using a driver or an ORM framework
C driver
C driver (OceanBase Connector/C)
OceanBase Connector/C is a C/C++ based client development component for OceanBase Database. It supports C API libraries.
This component allows C/C++ programs to access distributed OceanBase clusters from the underlying layer, enabling operations such as database connections, data access, error handling, and prepared statement processing.
Also known as LibOBClient, OceanBase Connector/C is used by applications as an independent server process to communicate with OBServer nodes through network connections. During compilation, client programs reference the C API header files and connect to the C API library files.
Note
The
.sofile generated by LibOBClient islibobclient.so, corresponding to thelibmysqlclient.sofile in MySQL. OceanBase Database uses OBClient as its CLI tool, equivalent to the CLI tool in MySQL.For more information about how to connect to OceanBase Database by using a C application, see Build a C application.
Golang
Golang driver
Go-SQL-Driver/MySQL
Go-SQL-Driver/MySQL is a MySQL driver written in Go. It implements the standard database/SQL interface of Go and can be easily integrated with Go applications. For more information about how to connect to OceanBase Database by using a Go application, see Build a Go application.
Golang ORM
GORM
GORM is an excellent ORM library for Go. It provides various features to help developers interact with databases more easily. For more information about how to connect to OceanBase Database by using GORM, see Connect to OceanBase Database by using GORM.
Java
Java driver (MySQL Connector/J)
MySQL Connector/J is the official JDBC driver provided by MySQL.
For more information about how to connect to OceanBase Database by using the Java driver, see Build a Java application.
Spring JDBC
For more information about how to connect to OceanBase Database by using Spring JDBC, see Connect to OceanBase Database by using Spring JDBC.
Java ORM framework
Spring Boot
For more information about how to connect to OceanBase Database by using Spring Boot, see Connect to OceanBase Database by using Spring Boot.
Spring Batch
For more information about how to connect to OceanBase Database by using Spring Batch, see Connect to OceanBase Database by using Spring Batch.
Spring Data JPA
For more information about how to connect to OceanBase Database by using Spring Data JPA, see Connect to OceanBase Database by using Spring Data JPA.
Hibernate
For more information about how to connect to OceanBase Database by using Hibernate, see Connect to OceanBase Database by using Hibernate.
MyBatis
For more information about how to connect to OceanBase Database by using MyBatis, see Connect to OceanBase Database by using MyBatis.
Java library test tool
Testcontainers
Testcontainers is an open-source Java library designed to provide a lightweight, containerized testing environment. It offers containerized dependencies, enabling developers to quickly start and manage Docker containers during tests, making integration testing more seamless. For more information about how to connect to OceanBase Database by using Testcontainers, see Connect to OceanBase Database by using Testcontainers.
PHP
PHP driver
EXT
EXT is a PHP extension for connecting to and interacting with different databases. It provides various features to help developers better manage databases and handle data. For more information about how to connect to OceanBase Database by using the EXT driver, see Connect to OceanBase Database by using the EXT driver.
MySQLi
MySQL Improved (MySQLi) is an official PHP extension for interacting with MySQL databases. It supports both object-oriented and procedural programming, offering features like prepared statements, transaction support, and multi-query execution to enhance performance and security. For more information about how to connect to OceanBase Database by using MySQLi, see Connect to OceanBase Database by using the MySQLi driver.
PDO
PHP Data Objects (PDO) provides a data-access abstraction layer that allows developers to interact with various databases in a unified manner. PDO supports prepared statements, which help enhance security and make it easier to migrate code between different databases. For more information about how to connect to OceanBase Database by using PDO, see Connect to OceanBase Database by using the PDO driver.
Python
Python driver (PyMySQL)
PyMySQL
PyMySQL is a library used to connect to MySQL servers in Python 3.x. It conforms to the Python Database API v2.0 specification and includes a pure-Python MySQL client library. In the MySQL mode of OceanBase Database, users can use the PyMySQL driver to enable connections between Python applications and OceanBase Database. For more information about how to connect Python applications to OceanBase Database, see Build a Python application.
mysqlclient
mysqlclient is a Python client library for MySQL databases. It encapsulates the MySQL Community C API. For more information about how to connect to OceanBase Database by using mysqlclient, see Connect to OceanBase Database by using mysqlclient.
MySQL Connector/Python (mysql-connector-python)
MySQL Connector/Python is a MySQL driver provided by Oracle, specifically designed for Python. It conforms to the Python Database API v2.0 specification and offers a comprehensive set of features, enabling seamless interaction with MySQL databases using Python. This library is platform-independent, supports both Python 2 and 3, and is implemented in pure Python without requiring any external libraries. In the MySQL mode of OceanBase Database, MySQL Connector/Python can also be used to establish connections with OceanBase Database, execute queries, and manage data. For more information about how to connect to OceanBase Database by using MySQL Connector Python, see Connect to OceanBase Database by using MySQL Connector Python.
Connection pools
OceanBase Database supports multiple connection pool implementations. You can select the one that best suits your business requirements.