../E27508-03.epub /> ../E27508-03.mobi />

11 External Procedures

This chapter describes how to create an environment on BS2000/OSD, where external procedure calls can operate. It complements the chapter about External Routines in the Fundamentals section of Oracle Database Advanced Application Developer's Guide.

11.1 Loading External Procedures

This section complements the corresponding part in Oracle Database Advanced Application Developer's Guide.

Follow these steps to load external procedures:

  1. Set up the environment.

    An external procedure does not run in the same process and address space as the caller. Oracle creates separate processes for them to operate in a safe and secure manner. For this purpose Oracle Net Services features are used and it is the responsibility of the user to provide appropriate Oracle Net Services parameter files. In this section, we have documented an example of how it can work. For more information, refer to Oracle Database Advanced Application Developer's Guide, Oracle Database Data Cartridge Developer's Guide, and Oracle Database Net Services documentation set.

    The listener.ora file should have the following entry:

    (SID_DESC = (SID_NAME = ep_agt1)
                (ENVS = EXTPROC_DLLS=ANY)
                (ORACLE_SID = sid_of_your_database)
                (PROGRAM = EXTPROC)
    )
    

    The tnsnames.ora file should have the following entry:

    extproc_connection_data = (DESCRIPTION =(ADDRESS =(PROTOCOL=ipc)
    (KEY = sid_of_your_database)(CONNECT_DATA =(PRESENTATION=RO)
    (SID = ep_agt1)))
    

    Then you can start a listener.

  2. Identify the 'DLL'.

    A DLL in the BS2000 environment is a BS2000 LMS library containing the functions called as external procedures. When EXTPROC is loaded these functions are dynamically bound to the program.

    Use the following command to identify your library to Oracle:

    CREATE LIBRARY my_c_library AS '$myuserid.my-modlib';
    

    The external C routine has to be compiled and the generated LLM has to be stored in the LMS library. If you set the MODULE-PROPERTIES option LOWER-CASE-NAMES=*NO, then all lowercase letters in the entry names are converted to uppercase.

    Furthermore, if you set the MODULE-PROPERTIES option SPECIAL-CHARACTERS=*CONVERT-TO-DOLLAR, then all underscores (_) in entry names are converted to dollar signs ($), which must be considered when publishing the external procedure.

  3. Publishing and running external procedures does not differ from the description in Oracle Database Advanced Application Developer's Guide. Result messages about the execution of the external procedure can be found in a file named L.sid.EXTP.SYSOUT.tsn.