External Routines Oracle Database PL/SQL 10g Programming Chapter 12.

Slides:



Advertisements
Similar presentations
Threads, SMP, and Microkernels
Advertisements

Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
Remote Procedure Call Design issues Implementation RPC programming
Advanced Package Concepts. 2 home back first prev next last What Will I Learn? Write packages that use the overloading feature Write packages that use.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
A Guide to Oracle9i1 Creating an Integrated Database Application Chapter 8.
1 Chapter 4 Threads Threads: Resource ownership and execution.
Oracle SQL*plus John Ortiz. Lecture 10SQL: Overview2 Overview  SQL: Structured Query Language, pronounced S. Q. L. or sequel.  A standard language for.
Presentation #36576 Presentation #36576 Oracle9i LDAP: Advanced Configuration of Directory Naming Daniel T. Liu Senior Technical consultant First American.
Access Manager for CICS/TS and Access Manager for IMS/TM Experiences Thomas Niewel Oracle Deutschland GmbH.
Chapter 2 Operating System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Client-Server – Lecture 4 Copyright System Managers LLC 2007 all rights reserved.
Oracle Database Administration
Enabling Advanced Net8 Features. Configuring Advanced Network Address and Connect Data Information.
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
Oracle for Software Developers. What is a relational database? Data is represented as a set of two- dimensional tables. (rows and columns) One or more.
Introduction to PL/SQL Oracle Database PL/SQL 10g Programming Chapter 1 & 2.
5 Copyright © 2008, Oracle. All rights reserved. Configuring the Oracle Network Environment.
5 Copyright © 2007, Oracle. All rights reserved. Configuring the Oracle Network Environment.
Oracle8 JDBC Drivers Section 2. Common Features of Oracle JDBC Drivers The server-side and client-side Oracle JDBC drivers provide the same basic functionality.
Exceptions Oracle Database PL/SQL 10g Programming Chapter 7.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: System Structures.
CHAPTER 2 Implementing a Database. Introduction to Creating Databases After you’ve installed the Oracle software, the next logical step is to create a.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
1 Oracle Database (9i) For Sun SPARC Solaris Installation Guide Version : 전자계산소 전자계산소 조성환
ABC Insurance Co. Paul Barry Steve Randolph Jing Zhou CSC8490 Database Systems & File Management Dr. Goelman Villanova University August 2, 2004.
1 © 2005 Julian Dyke Julian Dyke Independent Consultant juliandyke.com Web Version Native PL/SQL Compilation.
Java Introduction to JNI Prepared by Humaira Siddiqui.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 7 PL/SQL Packages.
Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package.
6 Copyright © 2009, Oracle. All rights reserved. Configuring the Oracle Network Environment.
Oracle 10g Database Administrator: Implementation and Administration Chapter 2 Tools and Architecture.
CERN - IT Department CH-1211 Genève 23 Switzerland t DB Development Tools Benthic SQL Developer Application Express WLCG Service Reliability.
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 2 (Part II) Operating System Overview.
7. CBM collaboration meetingXDAQ evaluation - J.Adamczewski1.
1 Copyright © 2004, Oracle. All rights reserved. Introduction to PL/SQL.
Trapping Oracle Server Exceptions. 2 home back first prev next last What Will I Learn? Describe and provide an example of an error defined by the Oracle.
12 Copyright © 2004, Oracle. All rights reserved. Understanding and Influencing the PL/SQL Compiler.
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
3 Copyright © Oracle Corporation, All rights reserved. Basic Oracle Net Server Side Configuration.
Stored Procedures. Definition a stored procedure is a set of Structured Query Language (SQL) statements with an assigned name that's stored in the database.
3 Copyright © 2004, Oracle. All rights reserved. Controlling Access to the Oracle Listener.
Chapter 9: Advanced SQL and PL/SQL Guide to Oracle 10g.
Chapter 4 Message-Passing Programming. The Message-Passing Model.
Nitin Singh,AAO/EDP,RTI Allahabad1 Troubleshooting.
Greenstone Internals How to Build a Digital Library Ian H. Witten and David Bainbridge.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Collaborative Planning Training. Agenda  Collaboration Overview  Setting up Collaborative Planning  User Setups  Collaborative Planning and Forecasting.
Oracle10g Developer: PL/SQL Programming1 Objectives Named program units How to identify parameters The CREATE PROCEDURE statement Creating a procedure.
Endpoints Lesson 17. Skills Matrix Endpoints Endpoints provide a reliable, securable, scalable messaging system that enables SQL Server to communicate.
IWR Ideen werden Realität Forschungszentrum Karlsruhe in der Helmholtz-Gemeinschaft Institut für Wissenschaftliches Rechnen Oracle Network Configuration.
5 Copyright © Oracle Corporation, All rights reserved. Usage and Configuration of the Oracle Shared Server.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
E Copyright © 2007, Oracle. All rights reserved. Using JDeveloper.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
© 2005 Solution Beacon, LLC. All Rights Reserved. Release 11i Workshops Release 11i … Please Add RAC Session Leader Kevin Dahl, Solution Beacon Release.
Basic Oracle Net Services Client-Side Configuration
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
4 Copyright © 2004, Oracle. All rights reserved. Advanced Interface Methods.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
9 Copyright © 2004, Oracle. All rights reserved. Getting Started with Oracle Migration Workbench.
Preface IIntroduction Course Objectives I-2 Oracle Complete Solution I-3 Course Agenda I-4 Tables Used in This Course I-5 The Order Entry Schema I-6 The.
Slide 1 © 2016, Lera Technologies. All Rights Reserved. Oracle Data Integrator By Lera Technologies.
WORKING OF SCHEDULER IN OS
SQL Database Management
Oracle11g: PL/SQL Programming Chapter 5 Procedures.
Introduction of Week 5 Assignment Discussion
Presentation transcript:

External Routines Oracle Database PL/SQL 10g Programming Chapter 12

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 2 External Routines Architecture Architecture Multithreaded Heterogeneous Agent Multithreaded Heterogeneous Agent Oracle Listener Configuration Oracle Listener Configuration C Libraries C Libraries Java Libraries Java Libraries PL/SQL Library Wrappers PL/SQL Library Wrappers Troubleshooting Shared Libraries Troubleshooting Shared Libraries

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 3 External Routines Architecture External Procedures: External Procedures: Are processes to communicate between external programs and the Oracle database. Are processes to communicate between external programs and the Oracle database. Are wrapped by PL/SQL stored program units. Are wrapped by PL/SQL stored program units. Use external languages that are callable from the C programming language. Use external languages that are callable from the C programming language. Use Oracle Net Services to communicate with external libraries. Use Oracle Net Services to communicate with external libraries. Use Oracle Call Interface (OCI) libraries to map data types. Use Oracle Call Interface (OCI) libraries to map data types.

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 4 External Routines Architecture

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 5 External Routines Multithreaded Heterogeneous Agent Monitoring thread manages dispatcher threads. Monitoring thread manages dispatcher threads. Dispatcher threads manage task threads. Dispatcher threads manage task threads. Task threads: Task threads: Manages external programs. Manages external programs. Exchanges variable values with external programs. Exchanges variable values with external programs.

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 6 External Routines Oracle Listener Configuration The listener.ora file contains the configuration information for communicating with extproc programs. The listener.ora file contains the configuration information for communicating with extproc programs. The listener.ora defines: The listener.ora defines: EXTPROC_DLLS to enable shared external libraries. EXTPROC_DLLS to enable shared external libraries. $LD_LIBRARY_PATH for the extproc agent. $LD_LIBRARY_PATH for the extproc agent. $PATH for the extproc agent. $PATH for the extproc agent. $APL_ENV_FILE for required environment variables that support the extproc agent. $APL_ENV_FILE for required environment variables that support the extproc agent. The IPC and TCP protocols should be run on separate listeners. The IPC and TCP protocols should be run on separate listeners.

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 7 External Routines Oracle Listener Configuration CALLOUT_LISTENER = (DESCRIPTION_LIST = (DESCRIPTION_LIST = (DESCRIPTION = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC) (ADDRESS = (PROTOCOL = IPC) (KEY = extproc) (KEY = extproc) ) ) ) )

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 8 External Routines Oracle Listener Configuration SID_LIST_CALLOUT_LISTENER = (SID_LIST = (SID_LIST = (SID_DESC = (SID_DESC = (SID_NAME = PLSExtProc) (SID_NAME = PLSExtProc) (ORACLE_HOME = ) (ORACLE_HOME = ) (PROGRAM = extproc) (PROGRAM = extproc) (ENV = "EXTPROC_DLLS=ONLY: (ENV = "EXTPROC_DLLS=ONLY: / /writestr1.so, / /writestr1.so, LD_LIBRARY_PATH= /lib") LD_LIBRARY_PATH= /lib") ) )

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 9 External Routines C Library: Sample Source /* Include standard IO. */ #include #include /* Declare a writestr function. */ void writestr1(char *path, char *message) { /* Declare a FILE variable. */ /* Declare a FILE variable. */ FILE *file_name; FILE *file_name; /* Open the File. */ /* Open the File. */ file_name = fopen(path,"w"); file_name = fopen(path,"w"); /* Write to file the message received. */ /* Write to file the message received. */ fprintf(file_name,"%s\n",message); fprintf(file_name,"%s\n",message); /* Close the file. */ /* Close the file. */ fclose(file_name); } fclose(file_name); }

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 10 External Routines C Library: Compilation Unix C Compiler that supports the –G option Unix C Compiler that supports the –G option cc –G –o writestr1.so writestr1.c Unix C Compiler that supports the –shared option Unix C Compiler that supports the –shared option cc –shared –o writestr1.so writestr1.c or gcc –shared –o writestr1.so writestr1.c

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 11 External Routines C Library: Defining Library CREATE [OR REPLACE] LIBRARY {AS | IS} ' / /. ';

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 12 External Routines Java Library: I/O Permissions -- Grant Java permission to file I/O against a file. DBMS_JAVA.GRANT_PERMISSION('PLSQL' 'SYS:java.io.FilePermission' 'SYS:java.io.FilePermission' '/tmp/file.txt' '/tmp/file.txt' 'read'); 'read');

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 13 External Routines Java Library: Loading Class File Load the Java class file into the database: Load the Java class file into the database: $ loadjava –r –f –o –user plsql/plsql ReadFile1.class

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 14 External Routines PL/SQL Library Wrapper: C Language CREATE [OR REPLACE] PROCEDURE write_string (path VARCHAR2,message VARCHAR2) AS EXTERNAL LIBRARY library_write_string NAME "writestr " PARAMETERS (path STRING,message STRING); /

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 15 External Routines PL/SQL Library Wrapper: Java Language CREATE [OR REPLACE] PROCEDURE read_string (file IN VARCHAR2) RETURN VARCHAR2 IS LANGUAGE JAVA NAME 'ReadFile.readString(java.lang.String) return String'; /

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 16 External Routines Troubleshooting Shared Libraries Listener ENV parameter is incorrect when an ORA is raised: Listener ENV parameter is incorrect when an ORA is raised: Incorrect synchronization of file path, EXTPROC_DLLS value, and PL/SQL wrapper NAME parameter. Incorrect synchronization of file path, EXTPROC_DLLS value, and PL/SQL wrapper NAME parameter. Incorrect value for EXTPROC_DLLS or LD_LIBRARY_PATH environment variables. Incorrect value for EXTPROC_DLLS or LD_LIBRARY_PATH environment variables.

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 17 External Routines Troubleshooting Shared Libraries Listener KEY parameter is incorrect or inconsistent between the listener.ora and tnsnames.ora files when an ORA is raised. Listener KEY parameter is incorrect or inconsistent between the listener.ora and tnsnames.ora files when an ORA is raised. An ORA is also raised when the extproc listener is shutdown or not running. An ORA is also raised when the extproc listener is shutdown or not running. An ORA is also raised when the extproc listener for IPC is not separated from the listener running for TCP communication. An ORA is also raised when the extproc listener for IPC is not separated from the listener running for TCP communication. Other errors occur when the name in the PL/SQL wrapper fails to resolve to a library file name. Other errors occur when the name in the PL/SQL wrapper fails to resolve to a library file name.

2006 Oracle Database PL/SQL 10g Programming (Chapter 12)Page 18 Summary Architecture Architecture Multithreaded Heterogeneous Agent Multithreaded Heterogeneous Agent Oracle Listener Configuration Oracle Listener Configuration C Libraries C Libraries Java Libraries Java Libraries PL/SQL Library Wrappers PL/SQL Library Wrappers Troubleshooting Shared Libraries Troubleshooting Shared Libraries