问题现象
OceanBase 数据库业务租户通过 OB-JDBC 连接执行 Load Data Local Infile 导入客户端本地数据时遇到报错:ERROR 9762 (42000) : Loading local data is disabled; this must be enabled on both the client and server sides。
OceanBase 数据库 Oracle 模式租户报错详情如下。

OceanBase 数据库 MySQL 模式租户报错详情如下。

问题原因
通过 OB-JDBC 连接 OceanBase 数据库时缺省不允许从客户端本地加载文件来执行 Load Data Local Infile,要使用该功能须强制开启 allowLoadLocalInfile=true 参数。
适用版本
OceanBase 数据库 V4.2.2 GA(oceanbase-4.2.2.0-100000082024011317 )及之后版本。
OBClient 客户端 V2.2.4 及之后版本。
OBProxy V3.2.4(oceanbase-3.2.4.0-100000072022102819)(V3.x 系列)及之后版本或者 V4.2.3(oceanbase-4.2.3.0-100000052024041220)(V4.x 系列)及之后版本(直连 OBServer 无此要求)。
OceanBase Connector/J V2.4.8 及之后版本。
解决方法
在 JDBC URL 连接串中添加 allowLoadLocalInfile=true 参数(注意参数名需要严格区分大小写,建议直接复制该参数)。
示例如下。
jdbc:oceanbase://<ip>:2881/SYS?rewriteBatchedStatements=true&allowMultiQueries=true&allowLoadLocalInfile=true