1 / 21

Oracle Application Server

Oracle Application Server. 1999. 3. 5 DB Lab. 이재광. 목차. Application Server 의 발전 Application Server 의 활용 PL/SQL Application Server 의 HTML 문법 Summary. Application Server 의 발전. Oracle Web Application Server 1.0 Oracle Web Application Server 2.0 Oracle Web Application Server 3.0

tareq
Download Presentation

Oracle Application Server

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Oracle Application Server 1999. 3. 5 DB Lab. 이재광

  2. 목차 • Application Server의 발전 • Application Server의 활용 • PL/SQL • Application Server의 HTML문법 • Summary

  3. Application Server의 발전 • Oracle Web Application Server 1.0 • Oracle Web Application Server 2.0 • Oracle Web Application Server 3.0 • Oracle 7을 기본 DBMS로 사용 • 미약하지만 CORBA지원 • Oracle Application Server 4.0 • 디스패칭, 로드-밸런싱 및 써드파티 서버 확장자의 첨가를 위한 고속 매커니즘인 Web Request Broker(WRB)를 사용함 • Oracle 8을 기반 DBMS로 사용 • CORBA 2.0 지원

  4. Application Server의 활용 • Application Server 4.0는 CORBA 2.0을 기준으로 만들어 졌고 CORBA 2.0을 지원하기 때문에 대형, 또는 중형과 같은 노드 분산을 위한 Web Server에 적당. • 최근에 나온 Oracle 8 기반이기때문에 ORDB를 지원 및 PL/SQL, SQL등을 지원하므로 Web 개발 적용가능. • Web 상으로 각종 조회, 수정 등 각종 DB관련 업무 개발에 편리

  5. PL/SQL Web Cartridges Application (cartridge server) Listener 1 3 6 2 5 4 Dispatcher Resource manager <HTML> <HEAD> … <BODY> …. Web request Broker

  6. PL/SQL의 기본(1) • PL/SQL의 프로시져 생성 예) create or replace procedure show_emp ( p_no number default 7900) is v_name emp.ename%type; v_sal emp.sal%type; begin select ename, sal into v_name, v_sal from emp where empno = p_no; htp.p(v_name||’, ’||v_sal||’<br>’); end; 실행 : destiny.inchon.ac.kr/plsql/show_emp?p_no=7788 • htp.p : Application Server의 출력 • 명령(C에서의 printf)

  7. PL/SQL의 기본(2) • 예외 처리를 이용한 PL/SQL create or replace procedure show_emp (p_no number default 7900) is v_name emp.ename%type; v_sal emp.sal%type; begin select ename, v_sal into v_name, v_sal from emp where empno = p_no; htp.p(v_name||’, ‘||v_sal||’<br>’); EXCEPTION WHEN NO_DATA_FOUND THEN htp.p(‘사원번호 ‘||p_no||’는 존재하지 않습니다’); WHEN OTHERS THEN htp.p(SQLERRM); end; 실행 : destiny.inchon.ac.kr/plsql/show_emp

  8. PL/SQL의 기본(3) • 여러 개의 Record를 받는 방법 create or replace procedure display_emp is cursor emp_cursor is select e.empno, ename, sal, d.dname from emp e, dept d where e.deptno = d.deptno order by e.empno; begin for hrec in emp_cursor loop htp.p(hrec.ename||’, ‘||hrec.sal||’, ‘||hrec.dname||’<br>’); end loop; end;

  9. PL/SQL의 기본(4) • OWA_UTIL.TABLEPRINT를 이용한 PL/SQL create or replace procedure display_emp is dummy BOOLEAN; begin header(‘사원조회’); dummy := owa_util.TablePrint(‘emp, dept’, ‘BORDER’, OWA_UTIL.HTML_TABLE,’empno, ename, dname, sal’, ‘where emp.deptno = dept.deptno’, ‘사원번호, 사원명, 부서명, 급여’); footer; end;

  10. PL/SQL의 기본(5) 결과

  11. Application Server의 HTML문법(1) • Application Server에는 PL/SQL을 지원하기 위한 PL/SQL Web Toolkit 을 제공. • OWA_COOKIE, OWA_IMAGE, OWA_UTIL • OWA_OPT_LOCK, OWA_TEXT, OWA_CUSTOM • OWA_PATTERN • HTP(Hypertext procedures), HTF(Hypertext functions) • Customized extensions • 모든 명령은 Package형태로 지원.

  12. Procedure Call htp.header(1,’Overview’); htp.print(‘Hello Word’); htp.para; htp.bold(‘Life is Great’); Generated HTML <H1>Overview</H1> Hello Word <P> <B>Life is Great</B> Application Server의 HTML문법(2)

  13. Application Server의 HTML문법(3) PROCEDURE footer IS BEGIN htp.address(‘&#169;Oracle Education’); htp.bodyClose; htp.htmlClose; END footer PROCEDURE show IS BEGIN header; body; footer; END show; END basic_htp; • Create a Basic Page PACKAGE basic_htp AS PROCEDURE show; END basic_htp; PACKAGE BODY basic_htp AS PROCEDURE header IS BEGIN htp.htmlOpen; htp.headOpen; htp.title(‘My First HTML Page’); htp.headClose; htp.comment(‘This is a comment’); END header; PROCEDURE body IS BEGIN htp.bodyOpen(cattributes => ‘BGCOLOR=“00FFFF”’); htp.header(1,’Heading Level 1’); htp.paragraph(‘CENTER); htp.print(‘My paragraph’); END body;

  14. Application Server의 HTML문법(4) • Dynamic HTML Table을 만들어 DB의 Data를 조회 create or replace procedure display_emp is cursor emp_cursor is select e.empno, ename, sal, d.dname from emp e, dept d where e.deptno = d.deptno order by e.empno; begin header(‘사원조회’); htp.tableOpen(‘BORDER’); htp.tableCaption(‘Employee Table’); htp.tableRowOpen; htp.tableHeader(‘사원번호’); htp.tableHeader(‘사원명’); htp.tableHeader(‘부서명’); htp.tableHeader(‘급여’); htp.tableRow.Close; for hrec in emp_cursor loop htp.tableRowOpen; htp.tableData(hrec.empno); htp.tableData(hrec.ename); htp.tableData(hrec.dname); htp.tableData(hrec.sal); end loop; htp.tableClose; footer; end;

  15. Application Server의 HTML문법(5) • Web에서 사원조회 Form 생성 create or replace procedure emp_query (the_dname in varchar2 default NULL, the_ename in varchar2 default NULL) is cursor cu is select * from dept order by deptno; dummy BOOLEAN; begin header(‘사원조회’); htp.br; htp.br; htp.centerOpen; if(the_dname is not null) then htp.img(‘/ows-img/ball_red.gif’); htp.bold(the_dname||’ 부서의 사원 현황’); htp.img(‘/ows-ing/ball_red.gif’); htp.br; htp.br; dummy := owa_util.tablePrint(‘emp, dept’, ‘BORDER’, owa_util.html_table, ‘empno, ename, dname, sal’, ‘where emp.deptno = dept.deptno and emp.ename like “’||the_ename||’%” and dept.dname = “’||the_dname||’|’, ‘사원번호, 사원명, 부서명, 급여’); htp.br; htp.br; htp.hr; end if; htp.formOpen(‘emp_query’); htp.p(‘조회할 조건을 넣으세요..’); htp.formSubmit(NULL,’조회’); htp.br; htp.br; htp.tableOpen; htp.tableRowOpen; htp.p(‘<TD><IMG SRC=“/ows-img/blueball.gif”>’); htp.p(‘ 사원 이름 : ‘);

  16. Application Server의 HTML문법(6) htp.formText(‘the_ename’, 10, 15); htp.tableRowClose; htp.tableRowOpen; htp.p(‘<TD><IMG SRC=“/ows-img/blueball.gif”>’); htp.formSelectOpen(‘the_dname’, ‘부서 : ‘); for I in cu loop htp.formSelectOption(I.dname); end loop; htp.form.SelectClose; htp.tableRowClose; htp.tableClose; htp.br; htp.br; htp.formClose; htp.centerClose; footer EXCEPTION WHEN OTHER THEN htp.p(SQLERRM); end; 조회

  17. Application Server의 HTML문법(7) • Web에서 데이터 입력 • 참고 1 • Web에서 데이터 삭제 • 참고 2

  18. Application Server의 HTML문법(8) • OWA_UTIL Package를 이용 create or replace procedure show_src is begin header(‘소스보기’); htp.br; owa_util.signature; hpt.br; htp.br; owa_util.signature(‘EMP_QUERY’); htp.br; htp.br; owa_util.showsource(‘EMP.QUERY’); footer; end; This page was produced by the Oracle Web Agent on March 5, 1999 11:35 AM

  19. Application Server의 HTML문법(9) Create or replace procedure show_env is v_path varchar2(100); v_ip varchar2(30); begin header(CGI Environment Variables’); htp.br; v_ip := owa_util.get_cgi_env(‘REMOTE_ADDR’); htp.p(‘Your IP Addess is ‘||v_ip); htp.hr; v_path := owa_util.get_cgi_env(‘HTTP_USER_AGENT’); htp.p(‘Your Web Browser is ‘||v_path); htp.hr; owa_util.print_cgi_env; footer; end; Server_name : The server host name server_software : The name and version gateway_interface http_accept : http_referer : The calling URL http_user_agent : The client’s browser

  20. Application Server의 HTML문법(10) • OWA_COOKIE를 이용 Cookie 설정한다. Create or replace procedure display_emp is v_cookie owa_cookie.cookie; begin owa_util.mime_header(‘text/html’,false); v_cookie := owa_cookie.get(‘counter’); if(v_cookie.num_vals > 0) then owa_cookie.send(‘counter’, v_cookie.vals(1)+ 1, Sysdate); else owa_cookie.send(‘counter,1,Sysdate); end if owa_util.http.header_close; header(‘Cookie’); htp.br; htp.br; if v_cookie.num_val > 0 then htp.print(‘당신은 이 사이트에 ‘||htf.strong(v_cookie.vals(1)+1 ||’ 번째 방문하셨습니다.’); else htp.print(‘This is your First visit here!’); end if; htp.br; htp.br; footer; end;

  21. Summary • Application Server는 쉽게 동적인 데이타베이스 정보를 만들어 준다. • PL/SQL CODE로부터 HTML 문서를 생성 • PL/SQL로 직접 TABLE에 Access • 실행시 PL/SQL cartridges로 컨트롤

More Related