The DBMS_JAVA.LOADJAVA procedure uploads a JAR package as an external resource to an OBServer node.
Note
This system package is available starting from OceanBase Database V4.4.0.
Syntax
DBMS_JAVA.LOADJAVA(IN jar_name VARCHAR(65535), IN content LONGBLOB, IN comment VARCHAR(65535) DEFAULT '');
Parameters
| Parameter | Description |
|---|---|
| jar_name | The name of the external resource. You can query the DBA_OB_EXTERNAL_RESOURCES or CDB_OB_EXTERNAL_RESOURCES view for this parameter. |
| content | The binary content of the JAR package. |
| comment | Optional. The comment of the external resource. You can query the DBA_OB_EXTERNAL_RESOURCES or CDB_OB_EXTERNAL_RESOURCES view for this parameter. |
Considerations
To upload a JAR package as an external resource to an OBServer node, call the DBMS_JAVA.LOADJAVA procedure and specify the following three parameters:
- The name of the external resource. You can customize the name, which is case-insensitive and must be unique in the current database. You can reference the external resource by using this name.
- The binary content of the JAR package.
- The comment of the external resource. You can customize the comment.
Examples
Call the DBMS_JAVA.LOADJAVA procedure to upload a JAR package as an external resource to an OBServer node.
String url = "<URL to Jar>";
InputStream is = new URL(url).openStream();
// conn is a connection to OceanBase
PreparedStatement ps = conn.prepareStatement("call dbms_java.loadjava(? ,? ,? )");
ps.setString(1, "my_add_jar");
ps.setBlob(2, is);
ps.setString(3, "my add UDF jar");
ps.execute();