Use Oracle Java on Autonomous AI Database
Autonomous AI Database supports Oracle JVM. Oracle JVM is a standard, Java-compatible environment that runs any pure Java application.
Oracle JVM is compatible with the standard JLS and the JVM specifications. It supports the standard Java binary format and the standard Java APIs. In addition, Oracle AI Database adheres to standard Java language semantics, including dynamic class loading at run time.
See About Using Java in Oracle AI Database for information on Oracle Java.
Enable Oracle Java
Use DBMS_CLOUD_ADMIN.ENABLE_FEATURE to enable Oracle Java on Autonomous AI Database.
-
Run
DBMS_CLOUD_ADMIN.ENABLE_FEATURE.BEGIN DBMS_CLOUD_ADMIN.ENABLE_FEATURE( feature_name => 'JAVAVM' ); END; /This initiates the request to install Oracle Java on the Autonomous AI Database instance.
See ENABLE_FEATURE Procedure for more information.
-
Restart the Autonomous AI Database instance.
See Restart Autonomous AI Database for more information.
After you restart the Autonomous AI Database instance, the Java installation proceeds for some time after the database starts. See Check Oracle Java Version to verify that Oracle JVM is enabled and the installation is complete.
Check Oracle Java Version
You can check the Oracle Java version and the component registry for information on Oracle Java in the Autonomous AI Database instance.
-
Check the component registry status and version for Oracle Java.
SELECT status, version FROM DBA_REGISTRY WHERE comp_id = 'JAVAVM'; STATUS VERSION ------ ---------- VALID 19.0.0.0.0If Oracle Java is not installed, this query shows no rows.
If Oracle Java is loading this query shows status
LOADING. For example:STATUS VERSION ------- ------- LOADING null -
Check the Oracle Java JDK version.
SELECT dbms_java.get_jdk_version FROM DUAL; GET_JDK_VERSION --------------- 1.8.0_411If Oracle Java is not installed, this query shows an error message.
Load Java classes and JAR Files into Autonomous AI Database
You can use the client-side loadjava option to load Java classes and JAR files into Oracle JVM on an Autonomous AI Database instance.
The client-side loadjava option is supported as follows:
-
The JDK opens the JAR file.
-
The client-side opens a communication channel with the Autonomous AI Database.
-
The Java code is submitted to the Oracle JVM running on the Autonomous AI Database for loading.
This process is similar to creating a dynamic Java stored procedure from SQL code, where no file access is involved, but the code gets created.
Note the following:
-
The Java code you load cannot invoke any operating system or network calls.
-
Use of server-side
loadjava, that is calls to the proceduredbms_java.loadjavais not supported. The proceduredbms_java.loadjavaaccesses the file system of the database server where the Oracle JVM runs. This is not allowed on Autonomous AI Database and calls to the proceduredbms_java.loadjavafrom within your Java application are not supported.
Notes for Oracle Java on Autonomous AI Database
Provides notes for using Oracle Java on Autonomous AI Database.
-
You cannot disable Oracle Java after it is enabled on the Autonomous AI Database instance.
-
Autonomous AI Database performs Oracle Java patching, as required, during the regular Autonomous AI Database maintenance window.
During Oracle Java patching, Java is not available and users could get an error similar to the following:
ERROR at line 1: ORA-29548: Java system class reported: release of Java system classes in the database (19.0.0.0.220118 1.8) does not match that of the oracle executable (19.0.0.0.220419 1.8).During the maintenance window, when the Java patching phase is active there is no response for Java session calls or you see the
ORA-29548error. After the maintenance window completes, Java usage is restored.You can use the events
NewMaintenanceScheduleandScheduledMaintenanceWarningto be notified of Oracle Java patching. See Information Events on Autonomous AI Database for more information.See About Scheduled Maintenance and Patching for more information.