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. Providers can implement and extend the JDBC standard 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 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.
OceanBase Connection/J is compatible with the OB2.0 protocol.
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. 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 provides the following main components:
DriverManager: loads the driver and returns the corresponding connections based on call requests.
Driver: handles requests and returns the corresponding connections. It is loaded to DriverManager.
Connection: communicates with a database, provides a connection environment for executing SQL statements and handling transactions, and creates and executes statements.
Statement:
Statement: performs a single SQL query or update operation.
PreparedStatement: executes cached statements with predetermined execution paths. Cached statements can be repeatedly executed to improve execution efficiency.
CallableStatement: executes stored procedures in a database.
SQLException: displays errors that occurred when a database connection was created or closed or when an SQL statement was executed.