1. Compile Java2. use loadjava to import the database. loadjava-ult; usergt; lt; passwdgt; @ lt; tnsgt;-r under $ ORACLE_HOMEbin
1. Compile Java2. use loadjava to import the database. loadjava-u lt; usergt;/lt; passwdgt; @ lt; tnsgt;-r under $ ORACLE_HOME/bin
1. Write Java
2. Use loadjava to import the database. loadjava is under $ Oracle_HOME/bin.
Loadjava-u / @ -Resolve-v
This method loads sourcecode into the database.
If you have previously loaded the same java program, you must first drop
Dropjava-u / @ -V
3. Check that the java database has been imported
Select * from user_source where type LIKE 'java % 'and name =' '
4. Create a function
CREATE OR REPLACE FUNCTION ( ) RETURN AS
LANGUAGE JAVA
Name' ( ) Return java datatype of return variable ';
Appendix:
If you need java to access files, you must use the dba user to grant permissions.
EXEC Dbms_Java.Grant_Permission ('onboarding ', 'sys: java. lang. runtimepermission', 'writefiledescriptor ','');
EXEC Dbms_Java.Grant_Permission ('onboarding ', 'sys: java. lang. runtimepermission', 'readfiledescriptor ','');
EXEC dbms_java.grant_permission ('onboarding ', 'sys: java. io. filepermission',' <> ', 'execute ');
The statement for revoking permissions is as follows:
EXEC Dbms_Java.revoke_Permission ('onboarding ', 'sys: java. lang. runtimepermission', 'writefiledescriptor ','');
EXEC Dbms_Java.revoke_Permission ('onboarding ', 'sys: java. lang. runtimepermission', 'readfiledescriptor ','');
EXEC dbms_java.revoke_permission ('onboarding ', 'sys: java. io. FilePermission', '<>', 'execute ');
,