Dbmsjava Grantpermission Example
Java has been in existence for more than a decade and is one of the more powerful development languages. Oracle, for instance, has developed many tools utilizing Java. Oracle 11g comes with a lot of improvements in the Java language such as having the best native Java compiles, supporting Content Repository API for Java, having scalable Java with the automatic creation of 100% native Java code and more. The dbms_java package is available when Oracle JVM is installed, which has been supported since Oracle 8i. This package lets developers use Java to create, store and deploy code within Oracle databases. we will highlight some of the more common uses of the dbms_java package. Functions and procedures will be demonstrated, and a brief description will be noted about each command. The first example grants execute privilege s to all files located in the /bin directory to the pkg user. < Code 7.12 - dbms_java.sql conn sys@ora11g as sysdba Connected to Oracle 11g Enterprise Edition Release 11.1.0.6.0 conn / as sysdba --Grant permission to execute any command on /bin directory to pkg user --Check the permission granted by consulting dba_java_policy view Kind Grantee Type Name Action -------- ---------- ------------------------- ---------- ---------- grant pkg java.io.FilePermission /bin/* execute To change any native compiler option for a user session, use the set_native_compile_option procedure followed by the native_compile_options function to get the results. --Change a native compile option for user session --Get current native compile options --Compile a java class In order to get the full name of a Java object, use the longname function as shown in the next example: --Long object name With more than 100 procedures and functions, the dbms_java package cannot be fully covered in this book. Most of the procedures and functions are executed by GUI or other programs and the user usually will not need to run them manually. This being said, it is wise to have at least a basic understanding of it and be familiar with how they are working within the database. Inside the DBMS Packages Burleson is the American Team Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals. Feel free to ask questions on our Oracle forum. Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications. Errata? Oracle technology is changing and we strive to update our BC Oracle support information. If you find an error or have a suggestion for improving our content, we would appreciate your feedback. Just e-mail: Copyright © 1996 - 2020 All rights reserved by Burleson Oracle ® is the registered trademark of Oracle Corporation.
begin
dbms_java.grant_permission(
grantee => 'pkg',
permission_type => 'java.io.FilePermission',
permission_name => '/bin/*',
permission_action => 'execute');
end;
/
col "kind" for a8
col "grantee" for a10
col "type" for a25
col "name" for a10
col "action" for a10
select
kind "kind",
grantee "grantee",
type_name "type",
name "name" ,
action "action"
from
dba_java_policy
where
grantee='pkg';
begin
dbms_java.set_native_compiler_option(
optionName => 'optimizerLoopPagedConversion',
value => 'false');
end;
/
select
dbms_java.native_compiler_options
from
dual;
--Find the java to be compiled
select
owner,
name,
source
from
dba_java_classes
where
name like 'java/io/FilePermissionCollection';
--Compile it using compile_class function!
select
dbms_java.compile_class(
classname => 'java/io/FilePermissionCollection')
from
dual;
select
dbms_java.longname (object_name)
from
user_objects
where
object_type ='java class'
and
status = 'valid'
and object_name like '%DelegateInvocationH%';
The DBMS packages form the foundation of Oracle DBA functionality. Now, Paulo Portugal writes a landmark book Advanced Oracle DBMS Packages: The Definitive Reference. This is a must-have book complete with a code depot of working examples for all of the major DBMS packages. Order directly from Rampant and save 30%.
and include the URL for the page.
Source: http://www.dba-oracle.com/t_packages_dbms_java.htm
0 Response to "Dbmsjava Grantpermission Example"
Post a Comment