DAD : Database Access Descriptor
DAD 만들기 (create_dad)
BEGIN
DBMS_EPG.create_dad (
dad_name => ‘my_epg_dad’,
path => ‘/my_epg_dad/*’);
END;
/
매핑 확인 (get_all_dad_mappings)
SET SERVEROUTPUT ON SIZE UNLIMITED
DECLARE
l_paths DBMS_EPG.varchar2_table;
BEGIN
DBMS_EPG.get_all_dad_mappings (
dad_name => ‘my_epg_dad’,
paths => l_paths);DBMS_OUTPUT.put_line(’Mappings’);
DBMS_OUTPUT.put_line(’========’);
FOR i IN 1 .. l_paths.count LOOP
DBMS_OUTPUT.put_line(l_paths(i));
END LOOP;
END;
/
DECLARE
l_paths DBMS_EPG.varchar2_table;
BEGIN
DBMS_EPG.get_all_dad_mappings (
dad_name => ‘my_epg_dad’,
paths => l_paths);DBMS_OUTPUT.put_line(’Mappings’);
DBMS_OUTPUT.put_line(’========’);
FOR i IN 1 .. l_paths.count LOOP
DBMS_OUTPUT.put_line(l_paths(i));
END LOOP;
END;
/
매핑 변경하기 (unmap_dad, map_dad)
BEGIN
DBMS_EPG.unmap_dad (
dad_name => ‘my_epg_dad’,
path => ‘/my_epg_dad/*’);DBMS_EPG.map_dad (
dad_name => ‘my_epg_dad’,
path => ‘/my_epg_dad/*’);
END;
/
DBMS_EPG.unmap_dad (
dad_name => ‘my_epg_dad’,
path => ‘/my_epg_dad/*’);DBMS_EPG.map_dad (
dad_name => ‘my_epg_dad’,
path => ‘/my_epg_dad/*’);
END;
/
DAD의 속성 설정 (set_dad_attribute)
BEGIN
DBMS_EPG.set_dad_attribute (
dad_name => ‘my_epg_dad’,
attr_name => ‘database-username’,
attr_value => ‘SCOTT’);DBMS_EPG.set_dad_attribute (
dad_name => ‘my_epg_dad’,
attr_name => ‘default-page’,
attr_value => ‘home’);
END;
/
DBMS_EPG.set_dad_attribute (
dad_name => ‘my_epg_dad’,
attr_name => ‘database-username’,
attr_value => ‘SCOTT’);DBMS_EPG.set_dad_attribute (
dad_name => ‘my_epg_dad’,
attr_name => ‘default-page’,
attr_value => ‘home’);
END;
/
지정된 DAD 의 모든 속성 얻기 (get_all_dad_attributes)
SET SERVEROUTPUT ON SIZE UNLIMITED
DECLARE
l_attr_names DBMS_EPG.varchar2_table;
l_attr_values DBMS_EPG.varchar2_table;
BEGIN
DBMS_OUTPUT.put_line(’Attributes’);
DBMS_OUTPUT.put_line(’==========’);DBMS_EPG.get_all_dad_attributes (
dad_name => ‘my_epg_dad’,
attr_names => l_attr_names,
attr_values => l_attr_values);
DECLARE
l_attr_names DBMS_EPG.varchar2_table;
l_attr_values DBMS_EPG.varchar2_table;
BEGIN
DBMS_OUTPUT.put_line(’Attributes’);
DBMS_OUTPUT.put_line(’==========’);DBMS_EPG.get_all_dad_attributes (
dad_name => ‘my_epg_dad’,
attr_names => l_attr_names,
attr_values => l_attr_values);
FOR i IN 1 .. l_attr_names.count LOOP
DBMS_OUTPUT.put_line(l_attr_names(i) || ‘=’ || l_attr_values(i));
END LOOP;
END;
/
지정된 DAD의 지정된 속성 얻기 (get_dad_attribute)
SET SERVEROUTPUT ON SIZE UNLIMITED
DECLARE
l_attr_name VARCHAR2(30);
l_attr_value VARCHAR2(30);
BEGIN
DBMS_OUTPUT.put_line(’Attribute’);
DBMS_OUTPUT.put_line(’=========’);l_attr_name := ‘database-username’;
l_attr_value := DBMS_EPG.get_dad_attribute (
dad_name => ‘my_epg_dad’,
attr_name => l_attr_name);
DECLARE
l_attr_name VARCHAR2(30);
l_attr_value VARCHAR2(30);
BEGIN
DBMS_OUTPUT.put_line(’Attribute’);
DBMS_OUTPUT.put_line(’=========’);l_attr_name := ‘database-username’;
l_attr_value := DBMS_EPG.get_dad_attribute (
dad_name => ‘my_epg_dad’,
attr_name => l_attr_name);
DBMS_OUTPUT.put_line(l_attr_name || ‘=’ || l_attr_value);
l_attr_name := ‘default-page’;
l_attr_value := DBMS_EPG.get_dad_attribute (
dad_name => ‘my_epg_dad’,
attr_name => l_attr_name);
DBMS_OUTPUT.put_line(l_attr_name || ‘=’ || l_attr_value);
END;
/
DAD 속성 삭제 (delete_dad_attribute)
BEGIN
DBMS_EPG.delete_dad_attribute (
dad_name => ‘my_epg_dad’,
attr_name => ‘database-username’);
END;
/
DAD 유저 인증 (authorize_dad, deauthorize_dad)
BEGIN
DBMS_EPG.authorize_dad (
dad_name => ‘my_epg_dad’,
user => ‘SCOTT’);
END;
/BEGIN
DBMS_EPG.deauthorize_dad (
dad_name => ‘my_epg_dad’,
user => ‘SCOTT’);
END;
/
DBMS_EPG.authorize_dad (
dad_name => ‘my_epg_dad’,
user => ‘SCOTT’);
END;
/BEGIN
DBMS_EPG.deauthorize_dad (
dad_name => ‘my_epg_dad’,
user => ‘SCOTT’);
END;
/
간단한 DAD 프로시져
CREATE OR REPLACE PROCEDURE scott.home IS
BEGIN
HTP.htmlopen;
HTP.headopen;
HTP.title(’This is a test page!’);
HTP.headclose;
HTP.bodyopen;
HTP.print(’This is a test page! DateTime: ‘ || TO_CHAR(SYSTIMESTAMP));
HTP.bodyclose;
HTP.htmlclose;
END home;
/
BEGIN
HTP.htmlopen;
HTP.headopen;
HTP.title(’This is a test page!’);
HTP.headclose;
HTP.bodyopen;
HTP.print(’This is a test page! DateTime: ‘ || TO_CHAR(SYSTIMESTAMP));
HTP.bodyclose;
HTP.htmlclose;
END home;
/