Java Database Connectivity (JDBC) is a Java standard that provides an API for connecting Java programs to a relational database. OceanBase Connector/J is a driver that implements the JDBC API to provide connections to OceanBase Database for Java-based applications.
The JDBC standard was defined by Sun Microsystems and is implemented by the standard java.sql API. Vendors 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 as a driver
OceanBase Connector/J is a JDBC Type 4 driver that can be connected to a database engine by using local protocols. OceanBase Database supports OceanBase Connector/J and is fully compatible with MySQL Connector Java, the native JDBC driver for MySQL. OceanBase Connector/J automatically determines whether OceanBase Database runs in MySQL or Oracle mode and supports both modes at the protocol layer.
OceanBase Connection/J is compatible with the OB2.0 protocol.
Notice
OceanBase Database determines 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. Tenants in Oracle mode can use only Oracle-compatible SQL syntax.
OceanBase Connector/J is compatible with standard JDBC APIs and Oracle JDBC. OceanBase Database in Oracle mode supports most Oracle syntax.
Features
OceanBase Connector/J mainly provides the following features:
DriverManager: Loads the driver and returns the corresponding database connections based on the call requests.
Driver: Handles requests and returns the corresponding database connections. It is loaded into DriverManager.
Connection: Communicates with the database, provides a connection environment for SQL execution and transaction handling, and creates and executes statements.
Statement:
Statements: Performs a single SQL query or update operation.
PreparedStatement: Executes cached statements with a pre-determined execution path. Cached statements can be repeatedly executed to improve execution efficiency.
CallableStatement: Executes stored procedures in the database.
SQLException: Displays errors that occur when creating or closing connections with the database or when executing SQL statements.