Connection methods overview

Updated at:
Copy as MD

This topic describes how to connect to an Oracle-mode tenant in an OceanBase database. You can connect to OceanBase Database using clients, drivers, or Object-Relational Mapping (ORM) frameworks.

Clients

You can use the following clients to connect to an Oracle-mode tenant in an OceanBase database:

  • OceanBase Client (OBClient)

    OBClient is a command-line interface for interactive and batch queries. It supports both MySQL-mode and Oracle-mode tenants in OceanBase Database. You can download and install it from the Software Center.

    OBClient requires the connection information for the OceanBase Database tenant at runtime. After you connect to OceanBase Database, you can use OBClient to run database commands, such as common Oracle commands, SQL statements, and PL statements. You can perform the following tasks:

    • Calculate, store, and print query results.

    • Create database objects, and check and modify their definitions.

    • Develop and run batch scripts.

    • Perform database administration and modify parameters.

    For more information, see Connect to an OceanBase tenant using OBClient.

  • OceanBase Developer Center (ODC)

    OceanBase Developer Center (ODC) is an enterprise-grade database development platform designed for OceanBase Database. You can access and use it in the OceanBase console.

    ODC supports connections to both MySQL-mode and Oracle-mode tenants in OceanBase Database. It also provides database developers with features for daily development, such as WebSQL, SQL diagnostics, session management, and data import and export.

    For more information, see Connect to an OceanBase database using ODC.

Drivers

You can use the following drivers to connect to an Oracle-mode tenant in an OceanBase database:

  • Java driver (OceanBase Connector/J)

    OceanBase Connector/J is a driver for Java that uses the standard Java Database Connectivity (JDBC) API to connect to OceanBase Database.

    Java Database Connectivity (JDBC) is a Java standard that provides an interface for connecting to relational databases. The JDBC standard was defined by Sun Microsystems. It is implemented through the standard java.sql interface and allows various providers to implement and extend the standard with their own JDBC drivers. JDBC is based on the X/Open SQL Call Level Interface (CLI).

    The OceanBase Connector/J driver is a JDBC Type 4 driver. It communicates directly with the database engine through a native protocol. The Connector/J driver is compatible with the OB2.0 protocol.

    OceanBase Database supports the OceanBase Connector/J driver. The driver automatically detects whether the OceanBase Database runtime mode is MySQL or Oracle and is compatible with both modes at the protocol layer.

    Important

    OceanBase Database determines the runtime mode, MySQL or Oracle, based on the tenant name used in the JDBC driver connection. Oracle-mode tenants allow only Oracle-compatible SQL syntax.

    In addition to supporting the standard JDBC Application Programming Interface (API), OceanBase Connector/J is also compatible with the Oracle driver. The Oracle mode of OceanBase Database is compatible with most Oracle syntax.

    OceanBase Connector/J supports one-click installation. The driver installation package is named oceanbase-client-[version_number].jar.

    On the official OceanBase website, navigate to Resources > Download Hub > Public Cloud > Middleware. Under OceanBase JDBC Driver, click the version you need, and then log on to download the OceanBase Connector/J driver.

    For more information, see Connect to an OceanBase database using a Java driver.

  • C driver (OBCI)

    OceanBase Call Interface (OBCI) is a C language interface for OceanBase that is fully compatible with the Oracle Call Interface (OCI).

    OBCI lets you use the C language to manipulate data in an OceanBase database. It provides standard database access functions in a dynamic-link library (the OBCI library). Applications can use these functions by linking to this library at runtime.

    If you have a C language application written with Oracle OCI, you do not need to modify its source code. You can simply specify the OBCI library as the runtime library during linking. This library file is installed to the /u01/obclient/lib path by default.

    You can contact technical support to obtain the OBCI driver installation package. For more information, see Connect to an OceanBase database using a C driver.

ORM frameworks

Object-Relational Mapping (ORM) is a programming technique for converting data between different type systems in object-oriented programming languages. In effect, it creates a "virtual object database" that can be used within a programming language.

To use JDBC-based ORM frameworks to connect to an Oracle-mode tenant in OceanBase Database, see the following documents: