The DBMS_JAVA.RESTRICT_PERMISSION clause is used to set Java permission restrictions for a specified user or role. Restrictive class permissions take precedence over granting class permissions.
Note
This subprogram is available starting with OceanBase AI Database V4.6.3.
Syntax
The RESTRICT_PERMISSION statement provides two overloaded forms. The second form returns the primary key of the record for which permissions are being set via the key output parameter.
DBMS_JAVA.RESTRICT_PERMISSION(IN grantee VARCHAR(65535), IN permission_type VARCHAR(65535), IN permission_name VARCHAR(65535), IN permission_action VARCHAR(65535));
DBMS_JAVA.RESTRICT_PERMISSION(IN grantee VARCHAR(65535), IN permission_type VARCHAR(65535), IN permission_name VARCHAR(65535), IN permission_action VARCHAR(65535), OUT key BIGINT);
Parameters
Parameter |
Note |
|---|---|
| grantee | The name of the user or role whose privileges are being restricted. |
| permission_type | Java permission type, that is, the class name of the Java permission. For example, java.io.FilePermission. |
| permission_name | The target name corresponding to the permission, for example, /dev/random. |
| permission_action | The operation corresponding to the permission, for example, read. |
| key | Output parameter, which returns the primary key of the permission record set this time. |
Usage instructions
- Before calling
DBMS_JAVA.RESTRICT_PERMISSION, ensure that the tenant parameterob_enable_java_udfis enabled. Otherwise, an unsupported error will be returned. - Only the root user can operate Java permissions. Other users will receive an insufficient permission error when calling.
- Only system privilege types are supported. Non-system privilege types specified in the
SCHEMA:TYPEformat are not supported. - For privileges not in the allowlist, only the root user of the sys tenant (
root@sys) can perform operations. - This operation is idempotent: if the target permission record already exists and is enabled, it will not be recreated; if it exists but is disabled, it will be re-enabled.