This topic describes how to connect to the Oracle mode of OceanBase Database. Currently, you can connect to OceanBase Database by using a client, a driver, or an Object Relational Mapping (ORM) framework.
Connect to OceanBase Database by using a client
You can connect to an Oracle tenant of OceanBase Database by using any of the following clients:
OBClient
OceanBase Client (OBClient) is an interactive query tool that supports batch processing. It must be installed separately. OBClient provides a CLI and acts as the client when it is connected to OceanBase Database. It supports Oracle and MySQL tenants in OceanBase Database.
Before you use OBClient to connect to an OceanBase 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, 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.
ODC
OceanBase Developer Center (ODC) is an enterprise-level database development platform tailored for OceanBase Database.
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 connect to an OceanBase tenant by using ODC, see Connect to OceanBase Database by using ODC.
Connect to OceanBase Database by using a driver
You can connect to an Oracle tenant of OceanBase Database by using any of the following drivers:
Java driver (OceanBase Connector/J)
OceanBase Connector/J uses the standard Java Database Connectivity (JDBC) API for Java applications to connect to OceanBase Database.
JDBC is a Java standard that provides an API for connecting Java programs to a relational database. The JDBC standard is defined by Sun Microsystems and implemented through the standard
java.sqlAPI. Providers can implement and extend the standard by using their own JDBC drivers. JDBC is a Call Level Interface (CLI) based on X/Open SQL.OceanBase Connector/J is a JDBC Type 4 driver that can be connected to a database engine by using local protocols. OceanBase Connector/J is compatible with the OB2.0 protocol.
OceanBase Database supports OceanBase Connector/J and is fully compatible with MySQL Connector Java, the native JDBC driver for MySQL. OceanBase Connector/J is fully compatible with MySQL JDBC and can automatically determine whether OceanBase Database runs in MySQL or Oracle mode. It provides compatibility for both modes at the protocol level.
Notice
OceanBase Database determines whether to run in MySQL or Oracle mode based on the tenant name that is used when the JDBC driver is connected to the database service. Oracle tenants can use only Oracle-compatible SQL syntax.
OceanBase Connector/J is compatible with the standard JDBC API and Oracle Driver. The Oracle mode of OceanBase Database is compatible with most Oracle syntax.
OceanBase Connector/J can be installed with one click. The installation package is named
oceanbase-client-[Version No.].jar.To obtain the installation package of OceanBase Connector/J, go to OceanBase Download Center. For more information about the installation procedure, see OceanBase Connector/J.
For more information about how to connect Java applications to OceanBase Database, see Build a Java application.
C driver (OBCI)
OceanBase Call Interface (OBCI) is a C language tool for interface calls in OceanBase Database. It provides features that are fully compatible with Oracle Call Interface (OCI).
OBCI allows you to use the C language to manipulate data in OceanBase Database. OBCI provides standard database access features in the form of a dynamic-link library (OBCI library). Applications can use the features by connecting to this library.
OBCI is a C language call interface provided by OceanBase. It provides features that are compatible with OCI. If you want to use a C application written by using OCI, you need only to specify the OBCI library as the runtime library during linking. By default, library files are installed in the
/u01/obclient/libpath.For more information about how to connect C applications to OceanBase Database, see Build a C application.
Connect to OceanBase Database by using an ORM framework
ORM is a programming technique for data conversion between a relational database and an object-oriented programming language. This creates, in effect, a "virtual object database" that can be used from within the programming language.
You can connect to an Oracle tenant of OceanBase Database by using any of the following ORM frameworks:
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 JDBC
For more information about how to connect to OceanBase Database by using Spring JDBC, see Connect to OceanBase Database by using Spring JDBC.
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.