'; zhtm += ''; zhtm += '

' + pPage + ''; zhtm += ''; figDoc.write(zhtm); figDoc.close(); popUpWin.focus(); } //--> Using Oracle8 -- Chapter 26 - Using Other Oracle8 Features and Functionality

Using Oracle8


Chapter 26

Using Other Oracle8 Features and Functionality


National Language Support

National Language Support (NLS) is a feature that enables Oracle database users to interact with the database in their native language. It also enables applications written in different national languages to interact with different NLS configurations.

Oracle's NLS architecture has two main components: language-independent functions used to provide generic language features, and language-dependent data used to work with features for a specific language. Oracle Server uses several encoding schemes to enable NLS capability. In essence, letters typed from a keyboard are displayed onscreen with character encoding. The encoding schemes commonly used by Oracle8 Server are categorized into single-byte 7-bit (7-bit ASCII), single-byte 8-bit (ISO 8859/1), varying-width multi-byte (for Chinese and other Asian languages), and fixed-width multi-byte (a subset of varying-width multi-byte). For more information on encoding schemes and restrictions on character sets, review the Oracle8 Server Reference in the Oracle documentation set.

Oracle8 has a new datatype, NCHAR, which facilitates the existence of two character sets in one database instance. Oracle8 also adds support for fixed-length native Unicode 2.0 and Chinese language support.

Setting Database Character Set

Setting the database character set is something you should do before creating a database instance. All database character data is stored in the character set specified during database creation. Although you may be able to change the character set of objects created later, characters in the data dictionary are stored in the character set used during creation and can't be changed later. The database character set is used for the following items:

The database set must be derived from 7-bit ASCII or EDCDIC character sets. The database character set can be a varying-width multi-byte character set.

Setting National Character Set

The National Character set is used for handling data stored in the NCHAR, NCLOB, and NVARCHAR2 datatypes. You can use a fixed-width or a varying-width multi-byte character set for the National Character Set.

Some performance improves with the National Character Set
You might see some performance gain in string operations when you choose a fixed-width character set for the National Character Set versus a varying width character set. Smaller width (varying width) character sets are more efficient in reducing data storage capacity.

Setting Initialization File Parameters

You can set NLS parameters as default values for the server. The client software can alter the server default values, if desired. The following parameters in the initialization file (INITSID.ORA) set the default NLS values for the server:

NLS_LANGUAGE ="US7ASCII"
NLS_LANGUAGE="GERMAN"
NLS_TERRITORY="GERMANY"
NLS_CALENDAR="Gregorian"
NLS_CALENDAR='Thai Buddha"
NLS_DATE_FORMAT = "DD/MM/YYYY"
NLS_SORT = Greek

Setting Session Values

Most NLS parameters can be set in an interactive session and as environment variables on UNIX and Windows NT. You can set the following NLS variables as initialization parameters, environment variables, and ALTER SESSION parameters:

NLS_CURRENCYNLS_ISO_CURRENCY
NLS_DATE_FORMATNLS_NUMERIC_CHARACTERS
NLS_DATE_LANGUAGENLS_SORT

Setting NLS values interactively with the ALTER SESSION command
If you want to set a parameter such as NLS_DATE_LANGUAGE to Spanish by using an interactive ALTER SESSION command, the syntax would be ALTER SESSION SET NLS_DATE_LANGUAGE="SPANISH". For this particular session, the ALTER SESSION command will override the default value of NLS_DATE_LANGUAGE.

You can set NLS_LANGUAGE and NLS_TERRITORY as initialization parameters and ALTER SESSION parameters but not as environment variables.

The NLS variables that you can set only as environment variables are

NLS_CREDITNLS_LIST_SEPERATOR
NLS_DEBITNLS_MONETARY_CHARACTERS
NLS_DISPLAYNLS_NCHAR
NLS_LANG 

Using SQL NLS Options

You can use NLS parameters in SQL statements that depend on NLS conventions. Applications using these SQL functions can explicitly call the functions independently of the environment variables or session parameters:

Using environment variables modify NLS values
If you want to set the value of a variable such as NLS_CREDIT by using UNIX environment variables, the syntax would be setenv NLS_CREDIT="CR". This would append the symbol CR in financial statements and reports, wherever applicable.

For more details, refer to the Oracle8 Server Reference in the Oracle8 documentation set.

Advanced Replication

In today's distributed architecture and global economies, organizations have database servers all over the world and need to exchange information in a timely and efficient manner. Oracle Replication is widely used to provide data access to different Oracle databases, as well as provide redundancy in the case of disaster. Replication is also used to distribute processing loads in distributed systems and give mobile workers the capability to work with the master database site.

New replication features in Oracle8
Oracle8 provides several new features that enrich Replication functionality: parallel propagation of deferred transactions, internalized replication triggers, reduced data propagation, LOB (large binary object) support, data subsetting based on subqueries, and primary key snapshots. The number of transactions to be replicated as well as the mechanism have been improved over Oracle7. Oracle8 sends row-level changes over the network to the replicated site, also optimizing bandwidth requirements. Improvements in Replication Manager 1.4 also make it easier to design and manage a replicated environment.

Oracle provides two forms of replication: basic and advanced. In the most elementary form of replication-basic-replicated sites have read-only access to data being maintained at the master site. Advanced replication gives replicated sites full read/write access to data at the master site.

Advanced Replication Configurations

You can implement Oracle advanced replication by using two basic configurations or a combination of the two:

Advanced Replication Components

Replication objects, groups, sites, and catalogs are the basic components of an advanced replication configuration. Let's take a quick look at their definitions:

Advanced Replication User Accounts

An advanced replication configuration requires certain special user accounts: replication administrator, replication propagator, and replication receivers. Each site-snapshot or master-requires a replication administrator. The replication administrator, propagator, and receiver can be the same Oracle account but have to be set up individually.

Managing Job Queues

Oracle8 uses a combination of internal triggers, deferred transactions, and job queues to propagate data and object changes between replicated sites. The internal triggers capture the changes to be propagated and execute them on replicated sites by using remote procedure calls. These remote procedure calls are stored in deferred transaction queues for later propagation. The actual propagation process is managed by using job queues and deferred transactions.

A local job queue is maintained on each database server participating in the replicated configuration containing information about the PL/SQL procedure, the schedule to run the job, and so on. These jobs will probably include but not be restricted to pushing deferred transactions to master sites, purging applied transactions from deferred transaction queues, and refreshing update snapshot groups.

Use APIs to track advanced replication
Oracle8 also provides a set of application program interfaces (APIs) to track and facilitate advanced replication. Some of these packages are DBMS_DEFER_QUERY,DBMS_DEFER,DBMS_OFFLINE, DBMS_REPCAT, and DBMS_SNAPSHOT. These packages, in combination with the replication data-dictionary views, are used to find out information about a transaction. For a complete listing of these views and packages, refer to Oracle8Replication, which is part of the documentation set published by Oracle Corporation.

Oracle8 provides data-dictionary views that contain detailed information about deferred transactions. These views are used to administer an advanced replication configuration. Some views are DEFCALL, DEFCALL_DEST, DEFDEFAULTDEST, DEFERRCOUNT, DEFERR, and DEFSCHEDULE.

Transactions that can't be completed are rolled back at the destination site and are logged in the DEFERROR view, which stores the identity number of the transaction that couldn't be applied. The DEFCALL view lists each remote procedure call associated with a particular deferred transaction and the number of arguments to the procedure. However, to know the value of the argument, you have to know the type of argument. This is obtained by using the GET_ARG_TYPE function of the DBMS_DEFER_QUERY package:



Argument number of the remote call
Identity number of the deferred transaction; get its value from DEFERROR view


For example, in a SQL*Plus session, you would call this package as follows:



Numeric variable declared in SQL*Plus session; you can call it anything
ID number corresponding remote call

This function would return a numeric value that corresponds to a datatype: 1 represents VARCHAR2, 2 represents NUMBER, 11 represents ROWID, 12 represents DATE, 23 represents RAW, and 96 represents CHAR. When you know the value of the returned number and hence the corresponding datatype, you can use another function, GET_VARCHAR2_ARG (if the return value was 1 representing a VARCHAR2), to get the actual value of the datatype.

Preparing for Replication

The process of building a replicated architecture involves several steps that involve planning and making decisions regarding the replicated configuration. At this stage, you define the schemas to be replicated, including tables, packages, and triggers. You also decide the number of sites at which you want your data replicated.

For organizational efficiency and for ease of administration, it's a good idea to group objects into replication groups. With Oracle8, you can turn off replication for replicated groups without affecting the other groups. This helps sometimes when you want to do maintenance on certain schemas and don't want to stop the rest of the database to stop replication.

You also can decide if you want snapshot replication or full multimaster replication or a combination of both. On today's systems, a lot of static tables or metadata tables are meant for lookup only and don't change. You can decide not to replicate such static tables, at least when using Advanced Replication. When configuring snapshot replication, the additional components of the system are snapshot logs and refresh groups. Snapshot logs are created at each master site to support the necessary snapshots. Refresh groups are created at each snapshot site. At each snapshot site, you also create snapshot groups that correspond to master group objects.

Finally, depending on the need for "fresh or refreshed" data at replicated sites, you might want to decide on an interval at which you want the replicated data to go across to the replicated site. As a DBA, you'll have to go through some trial and error to get the exact configuration you want for your shop, depending on your business needs, nature and amount of data, money you can invest in hardware, and so forth.

Using Replication Manager

Oracle Replication Manager is a GUI tool that helps you build and track a replicated schema. This tool provides graphical shortcuts to several API calls that are normally made from the server, and displays information in a easy-to-understand graphical fashion.

This tool is available only in Windows
You can install Replication Manager on a PC that acts as client to an Oracle server, and most configuration and management can be done from within Replication Manager. Thus, the platform of the database server doesn't matter, as long you have a PC running Windows. If you still want to configure and track replication from a UNIX server or a workstation, you have to write/modify your own scripts.

Replication Manager comes with replication wizards that help configure a replication schema. With Replication Manager, you can also connect to a master site and create master replication groups. Replication Manager will also create the Replication Administrator, Propagator, and Receiver accounts. Finally, you can use Replication Manager to create the database links that facilitate communications between sites. You can configure and create multimaster as well as snapshot replication sites with this tool.

To start Replication Manager, from the Start menu choose Programs, Oracle Replication Manager. Click the icon for Oracle Replication Manager. Figure 26.1 shows the startup window of the Replication Manager.

Figure 26.1 : In Replication Manager's start-up window, the button for creating a database connection is on the right and the database connections are on the left.

Click the Create button on the right. In the Create DB Connection dialog box, you may or may not want to keep the two check boxes checked (see Figure 26.2), depending on how secure your PC and office environment is.

Figure 26.2 : Selecting the Auto Connect at Startup check box will autoconnect the Replication Manager to the database. Deselecting the Always Prompt for Password check box will store the pass-word locally on the PC, which isn't always recommended.

Set up a master site with the Replication Manager Setup Wizard

  1. From Replication Manager's File menu, choose Setup Wizard.
  2. The first dialog box lets you choose to set up a master site or a snapshot site (see Figure 26.3). Click the Next button to choose the default, Setup Master Sites.
    Figure 26.3 : You can choose to set up the master site or the snapshot site. For this example, we will look at creating a master site. The steps provided by the wizard are identical for both Multimaster and Snapshot Replication.
  3. In the next dialog box, you can choose from exiting sites or enter a new site name. Click the New button.
  4. In the New Master Site dialog box (see Figure 26.4), enter a Site Name. The user is preselected (SYSTEM). Also enter the password for the user SYSTEM, which in this case is the installation default of manager. Clicking OK will save your input and return you to the Setup Wizard - Setup Master Sites dialog box with your site name saved.
    Figure 26.4 : If you want more sites to be made master sites, click Add instead of OK after entering each site name and password. When done, click OK.

What's in a site name?
The site name corresponds to a service or Net8 alias with which you can connect to the database. For more information on Net8 aliases, refer to Chapter 24, "Configuring and Using Net8 Features."

  1. After you select all the sites you want, click the Next button to move to the next dialog box, which is for creating default administrators, propagators, and receivers (see Figure 26.5). You can accept the defaults or change them. When done, click Next.
    Figure 26.5 : Enter the Schema name and Password for the administrator account, and optionally different propagator/receiver accounts.
  2. In the next dialog box, you can optionally specify schemas to be created at the master sites to contain objects to be replicated (see Figure 26.6). For this example, we don't want any more schemas, so click Next.
    Figure 26.6 : If you want to create schemas to replicate objects at a master site, click the New button.
  3. The next dialog box lets you set values for scheduled links: Next Date, Interval Expression, Parallel Propagation, and Delay Seconds (see Figure 26.7). You can change the defaults if you want to, and then click Next.
    Figure 26.7 : Click the Edit buttons to change the default values for Next Date and Interval Expression.
  4. In the Default Purge Scheduling dialog box (see Figure 26.8), you can set values for Next Date, Interval Expression, and Rollback Segment for default purge schedules. Click Next when done.
    Figure 26.8 : Clicking the Edit button for Next Date brings up a graphical calendar (similar to the Windows calendar), from which you can select the next date. Clicking the Edit button for the Interval Expression brings up a Set Interval dialog box, in which you can set the interval as seconds, minutes, hours, and days (the smallest allowed value is 1 second).
  5. In the next dialog box, you can to customize the master site's settings (see Figure 26.9). For this example, we aren't customizing the master site, so simply click Next.
    Figure 26.9: Selecting the master site enables the Customize button. You can customize the administrative users, link scheduling, and purge scheduling.
  6. Click Finish in the last dialog box to accept all the values you've entered so far. The wizard creates the RepAdmin, propagator, receiver accounts, and schemas (see Figure 26.10). Clicking OK in the Setup Wizard Finish dialog box generates the master site(s). When it's completed, the wizard creates the master site, which is then visible in Replication Manager's left pane.
    Figure 26.10: Select the Record a Script check box in the final wizard dialog box to have the wizard generate a script of the replication management API calls that it uses to build the system. This script can be run in SQL*Plus, SQL Worksheet, or any interactive tool.
  7. After the master site is created, you can click the Configuration, Scheduling, Administration, and Database Objects folders in Replication Manager's left pane (see Figure 26.11).
    Figure 26.11: You can view the database object by owner or by object type.

Managing Replication

The process of managing replicated sites is more complex than administering single sites. The issues are different for each configuration, whether you're dealing with multimaster, snapshot, or hybrid. Let's take a quick look at several tasks that database and replication administrators must perform for smooth operation of a replicated configuration:

Defining quiescing
Although the term quiescing isn't recognized in the dictionary, it's related to the word "quiescent," which means quiet, still, inactive. In Oracle, quiescing refers to the process of suspending replication activity between sites. This is normally done before performing administration tasks on master sites.

Deciding a conflict resolution mechanism for an advanced replication architecture
Designers can use a combination of several conflict-resolution techniques, depending on the business and configuration needs of their sites: minimum and maximum update, earliest and latest time-stamp update, additive and average update, priority group and site priority update, overwrite and discard update, append site name/sequence uniqueness, and discard uniqueness. A good strategy for a replication designer would be to look at individual columns and groups to decide the nature of updates, and then design the conflict-resolution mechanism.

Spatial Data Cartridge

Spatial data refers to location characteristics of objects as they relate to each other in real-world two-dimensional relationships. A map is an example of spatial data. Geographic information systems (GIS) that store spatial data would be likely users of Oracle's Spatial Data Cartridge, which provides a set of functions and procedures designed specifically for storing, retrieving, and analyzing spatial data. (For more detailed definitions of cartridges, see the later section "Oracle Web Server Cartridges.") Besides data from GIS systems, two-dimensional computer-aided design (CAD) drawings could be also stored as spatial data, because CAD drawings indicate the location of objects/parts (actually, primitives) in relation to each other.

In most CAD packages, data representation is done internally with primitive datatypes. A "primitive" is the most basic form of representation of an object. Different forms of geometry, such as arcs and circles, are created by using a combination of primitive datatypes. Oracle's Spatial Data Cartridge supports three basic type of primitives and geometries (all two-dimensional) generated by using a combination of these three types:

The Spatial Data Model

The Oracle Spatial Data Model essentially consists of elements, geometries, and layers arranged hierarchically. Elements make up geometries, which in turn make up layers:

The Spatial Table Structure

Oracle's Spatial Data Cartridge uses four tables/views to store and index spatial data. These four tables make up a layer:

Syntax for tables that make up layer definition for spatial data
The syntax for these tables is layername_TABLE, where layername is the name of the layer and TABLE is either SDOLAYER,SDODIM,SDOGEOM, or SDOINDEX. A layer can be defined completely by using these four tables.

Spatial data indexing
Spatial data uses a special index, HHCODE, for indexing data. HHCODEs are also called "tiles." Users can adjust the number of tiles that cover a surface. In a way, it represents the granularity of a data search. The finer the grain, the longer it would take to search the data. The technique of determining how many tiles cover a surface is called "tessellation." Tile size can be fixed or variable.

TABLE 26.1  Columns of tables SDOLAYER, SDODIM, SDOGEOM, and SDOINDEX
Column Name:
Datatype:
Description:
SDOLAYER
SDO_ORDCNTNumber This column is the total count of ordinates per row present in the SDOGEOM table.
SDO_LEVELNumber This column maintains a count of number of times layername was tessellated during the index build stage.
SDODIM
SDO_DIMNUMNumber This column keeps track of the dimension to which a row refers. The minimum value is 1.
SDO_LBNumber This column is the lower bound (LB) of the ordinate in the relevant dimension. For example, on a X-Y coordinate system with a maximum X of 100 and minimum of -100, the LB would be -100.
SDO_UBNumber This column represents the upper bound of the ordinate in the relevant dimension. For example, if the dimension were latitude, this value would be 90.
SDO_TOLERANCENumber This represents the tolerance associated with points in the data. This value must be greater than zero. SDO_TOLERANCE will vary for different types of spatial data for different dimensions.
SDO_DIMNAMEVARCHAR This represents the name used for this dimension; it can be X/Y or latitude/longitude.
SDOGEOM
SDO_GIDNumber This column represents the geometric identifier (GID), a unique number that represents each geometrical object in a layer.
SDO_ESEQNumber This column represents the element sequence number. A geometrical object is comprised of primitive elements. This column lists each element in the geometry for that layer.
SDO_ETYPENumber This column represents the element type. For example, a POINT type has an ETYPE value of 1, a LINESTRING has a value of 2, and so on.
SDO_SEQNumber This column represents the sequence number of each row of data for the element.
SDO_X1Number This column represents the X value of the first X coordinate.
SDO_Y1Number This column represents the Y value of the first Y coordinate.
SDO_Xn and SDO_Yn NumberThese columns represent the X and Y values of the nth coordinate, respectively.
SDOINDEX
SDO_GIDNumber This column really acts as a foreign key to the SDOGEOM table.
SDO_CODERAW Data representation is done in the form of tiles. This column contains the value of the bit interleaved ID of a tile that covers SDO_ID.
SDO_MAXCODERAW This column is the SDO_CODE with an extra value one unit farther than the allowable maximum value of the index. Basically, it describes a logical tile.

Using Spatial Data

Spatial data must be treated differently as compared with conventional data, because the indexing and data-retrieval techniques are different. Spatial data can be entered into tables interactively from applications or by using SQL*Loader for mass/batch loads.

Spatial data is queried in essentially a two-step process. The first step, referred to as a "primary filter," uses algorithms to approximate search patterns to narrow down the search size. The output from the first filter is passed to the second stage (called the "secondary filter"). The secondary filter uses exact calculations of geometry to the smaller output of the primary filter to find a match.

Spatial data applications perform a spatial query when information contained in a bounding or a query window is requested. The query window calls the SDO_WINDOW package, which performs the data calculations.

A spatial join is the output of joining two tables (layers) with spatial operators. A spatial join would join two layers with the layername_SDOINDEX field. An example of a query that causes a spatial join could be a list of all road and railway intersections in town.

Oracle Web Server Cartridges

Oracle Web Application Server is a superset of a standard HTTP server, with extensions (cartridges) that integrate seamlessly with the Oracle server. Similar to Spatial Data Cartridges, the cartridges that ship with Oracle Web Server are functions and packages that act as extensions to the core database product of the Oracle database server. You can program cartridges in various programming languages, such as C++, C, Visual Basic, and Java.

Reading current documentation for Oracle Web Server
Because Oracle Web Application Server is evolving rapidly and has seen at least three version upgrades in the last two years, I recommend that you use the online documentation provided by Oracle Corporation along with the Web Application Server for configuring the cartridges and Web Request Broker because this area is evolving quickly. This section covers the basic principles of Oracle Web Application Server 3.0 and is meant as an introduction. You can refer to the online documentation for the most current configuration techniques.

The Web Application Server comes in two versions: advanced and standard. The advanced version is a superset of the standard version. Some notable features present in the advanced version but not in the standard version are as follows:

The major components that are similar in the advanced and standard version are as follows:

Oracle Web Application Server 3.0 has been replaced by version 4.0, which is called Oracle Application Server. Oracle Application Server is designed to enable organizations to deploy and manage applications on a single server, rather than on hundreds or thousands of desktop PCs (the case in a two-tier architecture). Oracle Application Server 4.0 is designed to support all types of network clients, serving as a central point of access to any database, application, or legacy system.

All features of version 3.0 are available in 4.0, including backward compatibility with all cartridges. Version 4.0 also has several new cartridges, including new Oracle Call Interface (OCI) cartridge for native access to Oracle databases, an ODBC cartridge for access to any third-party database, and a new Rdb cartridge for access to Oracle Rdb database applications. A COBOL cartridge, made by Fujistu Corporation, enables access to COBOL applications. The AppBuilder wizard, made by Borland, provides designers with step-by-step help for designing Web applications.

Using Oracle Web Application Server Cartridges

This section explains major features of two commonly used cartridges: PL/SQL and the Java cartridge. To understand the functioning of the cartridges, you need to understand the architecture of the Web Server. The Oracle Web Application Server has three major components:

Integrating Web Application Server with other major Web server listeners
You can use Web servers from Netscape or Microsoft as the listener component if you don't want to use the listener that ships with the Web Server. The Oracle Web Application Server Installation Guide has information on configuring other major vendor listeners to use with the Web Application Server.

Web Application Server comes bundled with several cartridges, of which the following are just some:

Handling Requests

When the Web Application Server receives a request from a client, the listener component processes the request first and determines how it should handle the request. If the request is for a static file (a file that exists on a file system), the listener fetches the file from the operating system and sends it to the client. If the request is to execute a CGI (Common Gateway Interface) file/script, the listener executes the file and sends the results back to the client.

If the request is for a cartridge, the listener performs the following:

The PL/SQL Cartridge

The PL/SQL Cartridge provides the environment for developing Web applications as PL/SQL procedures stored in an Oracle database server. (PL/SQL is Oracle Corporation's procedural language extension to SQL.) When you configure the PL/SQL Cartridge, you install packages that help generate HTML pages. These packages define procedures, functions, and datatypes you can use in your stored procedures. In each HTTP request for the PL/SQL Cartridge, the uniform resource locator (URL) specifies the PL/SQL agent (which contains connection information) and the name of the stored procedure to run. The URL can also contain values for any parameters required by the stored procedure.

Before you can use the PL/SQL Cartridge, you need to load the packages listed in this section into the database schemas from which you want to run the procedures. The packages define datatypes, functions, and procedures used by the cartridge, and you can use some of them in your Web application. The functions and procedures help you generate dynamic HTML pages that contain data retrieved from the database.

The PL/SQL agent and the DAD
Like the PL/SQL agent, a DAD is a named set of configuration values used for database access. It specifies information such as the database name or the SQL*Net/Net8 service name, the ORACLE_HOME directory, and NLS configuration information such as language, sort type, and date language. You can also specify username and password information in a DAD; if they aren't specified, the user will be prompted to enter a username and password when the URL is invoked. The PL/SQL agent specifies information such as which DAD to use, how much error information to return if an error occurs, a list of authorized ports that it can use, and transaction parameters. Each PL/SQL agent is associated with a DAD.

Oracle Web Application Servers comes with a set of prewritten PL/SQL packages called the PL/SQL toolkit. To install the PL/SQL Web Toolkit, use the PL/SQL agent administration forms that are created with the Web server installation. The installation procedure grants the CONNECT and RESOURCE roles to the database user and executes the $ORAWEB_HOME/ admin/owains.sql script, which installs the packages in the PL/SQL Web Toolkit. When the owains.sql script is run manually; you should launch it from Server Manager or SQL worksheet (part of Enterprise Manager). If you want to run it from SQL*Plus, see the header of the script for instructions.

The packages are installed in the user's schema. This ensures that the user can't use the subprograms in the packages to access data in another user's schema.

Figure 26.12 shows the components of an URL. The Web Application Server comes with the Web Application Server Manager, which is a set of HTML forms you use to configure the PL/SQL Cartridge, the PL/SQL agent, and the Data Access Descriptor (DAD). On these forms you enter information such as virtual paths for the PL/SQL Cartridge, the SQL*Net/Net8 service name for the DAD, and the error-reporting level for the PL/SQL agent. Figure 26.13 shows the configuration of a PL/SQL cartridge in the Oracle Web Application Architecture. Chapter 19, "Improving Throughput with SQL, PL/SQL, and Precompilers," and Appendix A, "Essential PL/SQL: Understanding Stored Procedures, Triggers, and Packages," provide more information on PL/SQL.

Figure 26.12: The basic components of an URL for the PL/SQL cartridge, showing the use of PL/SQL (functions, procedures, and packages) in the HTTP protocol. The parameters passed to the PL/SQL procedure act as query string, which can be called from HTML forms and other Web applications.

Figure 26.13: The Web listener is a common component of all cartridges (in this case, PL/SQL and Java cartridges). After the listener interprets a request, the request is routed to the Java cartridge or the PL/SQL cartridge.

Sequence of events observed when a PL/SQL Cartridge request is made

  1. The listener component of the Web Application Server receives the request from a client and determines who should handle it. In this case, it forwards the request to the Web Request Broker (WRB) because the request is for a cartridge.
  2. The WRB forwards the request to an available PL/SQL Cartridge.
  3. The PL/SQL Cartridge retrieves the name of the PL/SQL agent from the URL (request). It uses the agent's configuration values to determine to which database server to connect and how to set up the PL/SQL client configuration.
  4. The cartridge connects to the database with the PL/SQL agent's configured values, prepares the call parameters, and invokes the procedure in the database.
  5. The procedure generates the HTML page, which can include dynamic data accessed from tables in the database as well as static data. ("Static data" here refers to HTML pages, images, or both, which exist on a file system that's mapped to by the URL. "Dynamic data" refers to content created on-the-fly from a database query.)
  6. The output from the PL/SQL procedure is returned to the PL/SQL Cartridge and the client (browser) via a response buffer.

The Java Cartridge

Java is a object-oriented programming language developed by Sun Microsystems. Java has rapidly evolved into a variety of network computing and Web architectures. What makes Java so exciting is the promise of platform independence. In keeping with the popularity of Java, Oracle Corporation has developed a Java cartridge. An HTTP request routed to the Java Cartridge is processed by running a Java application that returns the HTTP response.

The Java Cartridge doesn't support Java applets (programs written in Java that can be downloaded over the network and run in a Web browser), but supports only Java applications. Java applications are loaded from a trusted file system (which is mapped to by the Web Server).

When the listener component of the Web Application Server receives requests for the Java Cartridge from browsers, the Java Cartridge interprets information in the URL to identify the Java application that should handle the request. The Java application then programmatically responds to the client, performs interim tasks, accesses a database, or performs other computing tasks. Ultimately, the Java application sends a response back through the Java Virtual Machine (JVM) and the Web Application Server to the client. Figure 26.13 shows the Java cartridge in the architecture of the Oracle Web Application Server.

Sequence of events observed when a Java Cartridge request is made

  1. The Web Application Server receives the request identified by a URL-for example, http://servername.domainname/java/myfirstclass.
  2. The listener knows by the URL string that the request needs to be routed to a cartridge, and routes the request to the WRB.
  3. The WRB of the Web Application Server dispatches the request. The WRB examines the URL and determines which cartridge should handle the request. If the URL is under a virtual path that belongs to the Java Cartridge, the WRB dispatches the request to the Java Cartridge.
  4. The WRB finds a Java Cartridge, if available, or starts one if none is available.
  5. The Java Cartridge receives the request, parses the URL, and finds the name of the application (actually, a Java class) to call. Normally, the last part of an URL string is the Java class. In the URL mentioned in step 1, myfirstclass is the application (class).
  6. The Java Cartridge loads the class and invokes it at its entry point, generates a response (including HTTP header and body), and returns the response. The Java Cartridge receives the response and returns it to the WRB, which forwards it to the browser client that made the request.

Oracle Advanced Queuing

Oracle Advanced Queuing (Oracle AQ) is an Oracle8 feature that integrates a messaging queuing system with the Oracle8 Server (Enterprise Edition). This allows you to store messages into queues that can be retrieved and processed when needed. The real advantage of advanced queuing is that it's an integrated and reliable queuing system that works without any extra middleware software. Applications access the queues through a PL/SQL interface.

Availability of Oracle AQ with Oracle Enterprise Edition
Oracle AQ isn't available with Oracle8 version of the product; it's available with the Enterprise Edition of the server. To take advantage of the full functionality of Oracle AQ option, you'll also need the Enterprise Edition version of Oracle8 with the Objects Option.

Using the DBMS_AQADM package
Oracle AQ provides a package called DBMS_AQADM that's used for creating, stopping, altering, starting, and dropping queues.

Oracle AQ Components and Terminology

Oracle AQ has certain terms and definitions typical to a messaging system. Let's take a quick look at some of the terms:

Suggested reading for more information on AQ
For more information about Advanced Queuing, read the chapter on Advanced Queuing included in the Oracle8 Server Application Administrator's Guide in the Oracle documentation set. In particular, a section in this chapter titled "Advanced Queuing by Example" deserves special mention, because it has several scenarios and situations worth reading.

Major Features of Oracle AQ

Oracle AQ has the following major features:


© Copyright, Macmillan Computer Publishing. All rights reserved.