The DBMS_JAVA.LOADJAVA procedure is used to upload a JAR package as an external resource to the OBServer.
Syntax
DBMS_JAVA.LOADJAVA(IN jar_name VARCHAR(65535), IN content LONGBLOB, IN comment VARCHAR(65535) DEFAULT '');
Parameters
Parameter |
Note |
|---|---|
| jar_name | The corresponding external resource name. You can find it in the DBA_OB_EXTERNAL_RESOURCES or CDB_OB_EXTERNAL_RESOURCES Query in the view. |
| content | The binary content of the JAR package. |
| comment | Optional. Indicates a comment. You can also add it at the DBA_OB_EXTERNAL_RESOURCES or CDB_OB_EXTERNAL_RESOURCES Query in the view. |
Usage instructions
Call the DBMS_JAVA.LOADJAVA system package to upload the JAR package as an external resource to the OBServer. This process requires three parameters:
- The resource name, which you can customize. The resource name is case-insensitive and must be unique in the current database. You can use this resource name to reference the external resource.
- The binary of the resource, that is, the binary content of the JAR package.
- Resource comments, which you can customize.
Examples
Use the DBMS_JAVA.LOADJAVA procedure to load a JAR package.
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();