Release date: May 6, 2026 Version: V2.4.18
Version overview
JDBC V2.4.18 enhances high availability and MySQL compatibility. It introduces support for the replication mode: in scenarios where OceanBase Database is deployed in a single-node primary-standby configuration without using ODP, JDBC can automatically switch between the primary and standby nodes (failover) through the replication mode, meeting the high availability requirements of single-node deployment. It also adds support for handling Auth Switch in the changeUser interface, improving the user switching scenarios under the caching_sha2_password authentication method. Additionally, it introduces the getProceduresReturnsFunctions connection parameter to control whether the getProcedures() and getProcedureColumns() methods in the DatabaseMetaData API return metadata of functions with the same name as stored procedures. Furthermore, this version fixes multiple critical defects, further improving the driver's capabilities and overall stability.
New features
JDBC supports replication mode
In OceanBase Database 4.x distributed clusters, ODP is typically deployed, and applications connect to the cluster using the SERVICE_NAME parameter. During primary-standby failover, ODP handles the switch, and applications do not need to modify the connection string. In OceanBase Database single-node deployment, ODP is usually not deployed, and the SERVICE_NAME method cannot be used. In single-node primary-standby deployment, JDBC or other drivers are required to implement automatic primary-standby switching.
V2.4.18 introduces the replication mode: you can configure both primary and standby nodes in the URL. If the primary node fails, JDBC automatically switches to the standby node to continue providing services, achieving automatic failover and enhancing the disaster recovery capabilities of single-node primary-standby deployment.
For more information, see Replication mode (single-node primary-standby failover).
changeUser interface supports Auth Switch
When using the caching_sha2_password authentication method, the server may return an Auth Switch Request to switch the authentication plugin during user switching via the changeUser interface. In previous versions, the changeUser interface did not handle Auth Switch, leading to failed user switching under this authentication method.
V2.4.18 adds support for recognizing and handling Auth Switch messages in the changeUser interface, enabling correct authentication switching under the caching_sha2_password method and improving user switching capabilities in secure authentication scenarios.
getProceduresReturnsFunctions connection parameter
MySQL JDBC provides the getProceduresReturnsFunctions parameter to control whether the getProcedures() and getProcedureColumns() methods in DatabaseMetaData return metadata of functions with the same name as stored procedures. In previous versions of OceanBase JDBC, this parameter was missing, and by default, metadata of both stored procedures and functions were returned.
V2.4.18 introduces the URL parameter getProceduresReturnsFunctions to control whether the above-mentioned interfaces return function metadata, improving consistency with MySQL JDBC behavior.
Compatibility changes
The compatibility changes in this version mainly involve the following URL parameters.
URL parameter changes
The following URL parameters are modified:
Parameter |
Change |
Description |
|---|---|---|
| getProceduresReturnsFunctions | New | Controls whether DatabaseMetaData.getProcedures() and getProcedureColumns() return metadata of functions with the same name as stored procedures. The default value is true, which returns metadata of both stored procedures and functions. If set to false, only metadata of stored procedures is returned. |
| obStrictJdbcCompatibility | New | Controls whether to strictly comply with MySQL JDBC and Oracle JDBC. The default value is false, which complies with the behavior of previous versions of OceanBase JDBC. If set to true, strict compliance mode is enabled. This parameter affects the compatibility behavior of V2.4.18 and later. |
Behavior of obStrictJdbcCompatibility
Strict compliance mode (obStrictJdbcCompatibility=true)
- Adds SQL type judgment for
executeBatchandexecuteLargeBatch: if the SQL type isSELECT, an exception is thrown, consistent with the behavior of MySQL JDBC and Oracle JDBC. - For
executeUpdateandexecuteLargeUpdate: in MySQL mode, SQL type judgment is performed, andSELECTthrows an exception, consistent with MySQL JDBC. In Oracle mode, no restrictions are applied, and normal execution is allowed, consistent with Oracle JDBC. - When
resultSetTypeisTYPE_FORWARD_ONLY, calling scrolling interfaces such asResultSet.previous()andbeforeFirst()will result in an exception, consistent with MySQL JDBC 8.
Non-strict compliance mode (obStrictJdbcCompatibility=false, default)
- Does not apply the above restrictions to
executeBatch,executeLargeBatch,executeUpdate, andexecuteLargeUpdate, allowing normal execution. - When
resultSetTypeisTYPE_FORWARD_ONLY, calling scrolling interfaces such asprevious()andbeforeFirst()does not result in an exception.
For a detailed comparison with subsequent versions and maintenance agreements, see Behavior comparison between strict compliance mode and non-strict compliance mode in JDBC.
Bug fixes
The following are the main issues fixed in this iteration.
MySQL compatibility
- Fixed the issue where the
caching_sha2_passworduser could not establish an SSL connection with OceanBase JDBC and returned error 23776. - Fixed the issue where the return value of
executeBatchand the behavior ofBatchUpdateExceptionwere inconsistent with those of the native MySQL JDBC driver. - Fixed the issue where the
rewriteBatchsyntax returned an error when the table name containedon_duplicate_key_update. - Fixed the issue where the table comments returned by
getTableswere garbled whenuseInformationSchema=false. - Fixed the issue where the
rs.previous()method and other scrollable interface methods did not return the correct error when the result set was not scrollable. - Fixed the issue where the return value of
isAfterLastwas inconsistent with that of the MySQL JDBC driver when the cursor result set was read to the end. - Fixed the issue where the compatibility of
rs.isAfterLast()was affected when the cursor result set was empty. - Fixed the issue where the results returned by
executeBatchwere inconsistent when theSELECTstatement used the PS protocol or the PS+ protocol. - Fixed the issue where the
Parameter at position 19999 is not seterror occurred whenuseBatchMultiSend=true. - Fixed the issue where an
ArrayIndexOutOfBoundsExceptionoccurred when the batch insert size was close to but did not exceedmaxPacketLengthwhenrewriteBatchedStatements=true.
Oracle compatibility
- Fixed the issue where OceanBase JDBC returned an error during the
conn.prepareCall("? = call PKF_NAMED.j(b=>?, a=>?, c=>?)")phase, while the native Oracle driver returned an error only during execution. - Fixed the issue where the
getObjectmethod could not output JSON data when the JSON type was converted toBLOBin Oracle mode. - Fixed the issue where an exception was thrown when
executeBatchwas called afteraddBatchwas executed for an SQL statement without parameters using ArrayBinding. - Fixed the issue where the
The count of return parameter must be larger than 0error occurred when the table name contained thereturningkeyword in theRETURNING INTOstatement. - Fixed the issue where an
IndexOutOfBoundsExceptionoccurred when a stored procedure with complex expressions was called usingconn.prepareCall. - Fixed the issue where the results did not meet expectations in the PL overload scenario: when
obIncludeOutOrNullParamTypeInfowas disabled during package creation and enabled during calls.
Data precision and protocols
- Fixed the issue where precision was lost in queries from Spring applications.
- Fixed the issue where the
NUMBER(20)type data18446744097622196224was converted to23912644608after being written to OceanBase. - Fixed the issue where the
unknown escape sequenceerror occurred when executingSELECT q'[select a='#{1}']' FROM dual. - Fixed the issue where a null pointer exception occurred when PS batch execution was performed with
useOceanBaseProtocolV20=true.
