This topic describes the methods for connecting to OceanBase Database in Oracle mode. 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
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 of OceanBase Database.
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 connect to an OceanBase Database tenant by using OBClient, 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.
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 Database 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) APIs 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 was defined by Sun Microsystems and is implemented by the standard
java.sqlAPI. Providers can implement and extend it 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 are fully compatible with MySQL Connector Java, which is the native JDBC driver for MySQL. OceanBase Connector/J is fully compatible with MySQL JDBC. OceanBase Connector/J automatically determines whether OceanBase Database runs in MySQL or Oracle mode and supports both modes at the protocol layer.
Notice
OceanBase Database determines whether the running mode is MySQL or Oracle based on the tenant name that is used when the JDBC driver is connected to the database service. Tenants in Oracle mode can use only Oracle-compatible SQL syntax.
OceanBase Connector/J is compatible with standard JDBC APIs and Oracle Driver. OBServers in Oracle mode are compatible with most Oracle syntax.
OceanBase Connector/J can be installed with one click. The installation package is
oceanbase-client-[Version No.].jar.To obtain the installation package of the OceanBase Connector/J driver, go to OceanBase Download Center.
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 Oracle 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.
Python driver
OceanBase Connector/J uses the standard JDBC APIs for Python applications to connect to OceanBase Database without using the Python module.
For more information about how to connect Python applications to OceanBase Database, see Build a Python application.
Connect to OceanBase Database by using an ORM framework
ORM is a programming technique that converts data between different types of systems in object-oriented programming languages. In effect, ORM actually creates a "virtual object database" that can be used in programming languages.
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 SpringBoot, see Connect to OceanBase Database by using SpringBoot.
Spring Batch
For more information about how to connect to OceanBase Database by using SpringBatch, see Connect to OceanBase Database by using Spring Batch.
Spring JDBC
For more information about how to connect to OceanBase Database by using SpringJDBC, see Connect to OceanBase Database by using Spring JDBC.
MyBatis
For more information about how to connect to OceanBase Database by using MyBatis, see Connect to OceanBase Database by using MyBatis.