< link rel="Stylesheet" href="../../dcommon/css/doccd.css" title="Default" type="text/css">

Skip Headers

Oracle&r eg; HTTP Server Administrator's Guide
10g Release 1 (10.1)

Part Number B12255-01
Go to Documentation Home
Home
Go to Book Li
st
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Mas
ter Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go t
o next page
Next
View PDF

7
Oracle HTTP Server Modules

This chapter describes t he modules (mods) included in the Oracle HTTP Server. The modules ext end the basic functionality of the Web server, and support integration between Oracle HTTP Server and other Oracle Database component s.

Documentation from the Apache Software Foundation is referenced when applicable.


Note:

Readers using this guide in PDF or hard copy formats will be unable to access third-party documentation, which Oracle prov ides in HTML format only. To access the third-party documentation referenced in this guide, use the HTML version of this guide and cl ick the hyperlinks.


List of Modules

Table 7-1 lists all the Oracle HTTP Server modules discussed in this chapter.

Table 7-1 Oracle HTTP Server Modules

Oracle HTTP Server Module s

mod_access

mod_actions

mod_alias

mo d_asis

mod_auth

mod_auth_anon

mod _auth_db

mod_auth_dbm

mod_auth_digest

mod_autoindex

mod_cern_meta

mod_certheaders

mod_cgi

mod_defi ne

mod_digest

mod_dir

mod_dms

mod_env

mod_example

mod_expires

mod_fastcgi

mod_headers

mod_imap

mod_include

mod_info

mod_isapi

mod_log_agent

mod_log_config

mod_log_referer

< p class="TB">mod_mime

mod_mime_magic

mod_mmap_static

mod_negotiation

mod_onsint

mod_ossl

mod_perl< /a>

mod_plsql

mod_proxy

mod_rewrite

mod_setenvif

mod_so

mod_speling

mod_status

mod_unique_id

mod_userdi r

mod_usertrack

mod_vhost_alias

 

mod_access

< p class="BP">Controls access to the server based on characteristics of a request, such as hostname or IP address.

See Also:

Module mod_access in the Apache Server documentation.

mod_actions

Enables execution of CGI scripts based on fil e type or request method.

See Also:< /strong>

Module mod_actions in the Apache Server documentation.

< font face="Arial, Helvetica, sans-serif" color="#330099">mod_alias

E nables manipulation of URLs in processing requests. It provides mapping between URLs and filesystem paths, and URL redirection capabi lities.

See Also:

Module mod_alias in the Apache Server d ocumentation.

mod_asis

Enables sending files that contain their own HTTP headers. It is not supported by Oracle.

See Also:

Module mod_asis" in the Apache Server documentation.

mod_auth

Enables user authentication with files based user lists.

See Also:

Module mod_auth in the Apache Server documentation.

mod_auth_a non

Enables anonymous user access to protected areas (similar to ano nymous FTP, where the email addresses can be logged).

< strong class="NH">See Also:

Module mod_auth_anon in the Apache Server documentation.

mod_auth_db

Uses Berkeley DB files to provide user authentication.

This module is disabled in the Oracle HTTP Server and is not supported by Oracle.

mod_auth_dbm

< p class="BP">Uses DBM files to provide user authentication.

This module is not supported by Oracle.

mod_auth_digest

Uses MD5 Digest Authentication to provide user authe ntication.

This module is not supported by Oracle.

mod_autoindex

Generates directory indexes automatically.

See Also:

Module mod_autoindex in the Apache Server documentation.

< /a>

mod_cern_meta

< !--/TOC=h1-->

Emulates CERN (Conseil Europeen pour le Recherche Nucleaire) HTTPD metafile seman tics. Metafiles are additional HTTP headers that can be produced for each file the server accesses, in addition to the typical set.

This module is not supported by Oracle.

< h2 class="H1">mod_certheaders

Enables reverse proxies that terminate SSL connections in front of Oracle HTTP Server to transfer information reg arding SSL connection, such as SSL client certificate information, to Oracle HTTP Server, and applications running behind Oracle HTTP Server. This information is transferred from the reverse proxy to Oracle HTTP Server using HTTP headers. The information is transfer red from the headers to the standard CGI environment variable, which mod_ossl or mod_ssl populates if the S SL connection is terminated by Oracle HTTP Server. It also enables certain requests to be treated as HTTPS requests even though they are received through HTTP.

Perform the following steps to configure mod_certheaders:

  1. Configure Oracle HTTP Server to load mod_certheaders. To do this, add a LoadModule directive to httpd.conf file.
    • UNIX: LoadModule certheaders_module libexec/m od_certheaders.so
    • Windows: LoadModule certheaders_module modules/ ApacheModuleCertHeaders.dll
  2. Specify which headers shou ld be translated to CGI environment variables. This can be achieved by using the AddCertHeader directive. This directive takes a single argument, which is the CGI environment variable that should be populated from a HTTP header on incoming requests. For example, to populate the SSL_CLIENT_CERT CGI environment variable, add the following line to httpd.conf:
    AddCertHeader SSL_CLIENT_CERT
    
    

    The AddCertHeader directive can be a global setting if it is placed in the base virtual server section of htt pd.conf. It can be specific to a single virtual host by placing it within a virtual host container, or it can be specific to a set of URIs by placing it within a <Directory> or <Location> container directive within httpd.conf. The combination of these directives are addi tive, so that for a given URI, all directives that are specific to that URI will be added to any that are specific to that request's virtual host, which will be added to any that is defined for that base virtual host.

    Table 7-2 lists all the supported CGI environment variables with their corresponding HTTP header n ames.

    Table 7-2 CGI Environment Variables with Corresponding Header Names
    < td class="Formal">

    SSL_CLIENT_I_DN

    < td class="Formal">

    SSL_CLIENT_I_DN_Email

    CGI Variabl e Header Name CGI Variable Header Name

    SSL_PROTOCOL< /code>

    SSL-Protocol

    SSL_SESSION_ID

    S SL-Session_Id

    SSL_CIPHER

    SSL-Cipher

    SSL_CIPHER_EXPORT

    SSL-Cipher-Export

    SSL_CIPHER_ALGKEYSIZE

    < code>SSL-Cipher-Algkeysize

    SSL_VERSION_LIBRARY< /p>

    SSL-Version-Library

    SSL_CLIENT_CERT

    SSL-Client-Cert

    SSL_VERSION_INTERFACE

    SSL-Version-Interfa ce

    SSL_CLIENT_CERT_CHAIN_n

    SSL-Client-Cert-Chain-n

    SSL_CIPHER_USEKEYSIZE

    SSL-Cipher-Usekeysize

    SSL_CLIENT_VERIFY

    SSL-Client-Verify

    SSL_SERVER_C ERT

    SSL-Server-Cert

    SSL_CLIENT_M_VERSION

    SSL-Client-M-Version

    SSL_SERVER_M_VERSION

    SSL -Server-M-Version

    SSL_CLIENT_M_SERIAL

    SSL-Client-M-Serial

    SSL_SERVER_M_SERIAL

    SSL-Server-M-Serial

    SSL_CLIENT_V_START

    SSL-Client-V-Start

    SSL_SER VER_V_END

    SSL-Server-V-End

    SSL_CLIENT_V_END

    SSL-Client-V-End

    SSL_SERVER_V_END

    SSL-Serv er-V-End

    SSL_CLIENT_S_DN

    SSL-Client-S-DN

    SSL_SERVER_S_DN

    < /a>

    SSL-Server-S-DN

    SSL_CLIENT_S_DN_C

    SSL-Client-S-DN-C

    SSL_SERVER_S_DN_C

    SSL-Server-S-DN-C

    SSL_CLIENT_S_DN_ST

    < a name="1054303">

    SSL-Client-S-DN-ST

    SSL_SERVER_S_DN_ST

    SSL-Server-S-DN-ST

    SSL_CLIENT_ S_DN_L

    SSL-Client-S-DN-L

    SSL_SERVER_S_DN_L

    SSL-Server-S-DN-L

    SSL_CLIENT_S_DN_O

    SSL-Cli ent-S-DN-O

    SSL_SERVER_S_DN_O

    SSL-Server-S-DN-O

    SSL_CLIENT_S_DN_OU

    SSL-Client-S-DN-OU

    S SL_SERVER_S_DN_OU

    SSL-Server-S-DN-OU

    SSL_CLIENT_S_DN_CN

    SSL-Client-S-DN-CN

    < a name="1054337">

    SSL_SERVER_S_DN_CN

    SSL-Server-S-DN-CN

    SSL_CLIENT_S_DN_T

    SSL-Client-S -DN-T

    SSL_SERVER_S_DN_T

    SSL-Server-S-DN-T

    SSL_CLIENT_S_DN_I

    SSL-Client-S-DN-I

    SSL_SERV ER_S_DN_I

    SSL-Server-S-DN-I

    SSL_CLIENT_S_DN_G

    < /td>

    SSL-Client-S-DN-G

    SSL_SERVER_S_DN_G

    SSL- Server-S-DN-G

    SSL_CLIENT_S_DN_S

    SSL-Client-S-DN-S< /p>

    SSL_SERVER_S_DN_S

    SSL-Server-S-DN-S

    SSL_CLIENT_S_DN_D

    SSL-Client-S-DN-D

    SSL_SERVER_S_DN_D

    SSL-Server-S-DN-D

    SSL_CLIENT_S_DN_UID

    SSL-Client-S-DN-Uid

    SSL_SERVER_S_DN_UID

    SSL-Server- S-DN-Uid

    SSL_CLIENT_S_DN_Email

    SSL-Client-S-DN-Email

    SSL_SERVER_S_DN_Email

    < a name="1054395">

    SSL-Server-S-DN-Email

    SSL-Client-I-DN

    SSL_SERVER_I_D N

    SSL-Server-I-DN

    SSL_CLIENT_I_DN_C

    SSL-Client-I-DN-C

    SSL_SERVER_I_DN_C

    SSL-Server-I-D N-C

    SSL_CLIENT_I_DN_ST

    SSL-Client-I-DN-ST

    SSL_SERVER_I_DN_ST

    SSL-Server-I-DN-ST

    SSL_CLIENT_I_DN_L

    SSL-Client-I-DN-L

    SSL_SERVER_I_DN_L

    SSL-Server-I-DN-L

    SSL_CLIENT_I_DN_O

    SSL-Client-I-DN-O

    SSL_SERVER_I_DN_O

    SSL-Server-I-DN-O

    SSL_CLIE NT_I_DN_OU

    SSL-Client-I-DN-OU

    SSL_SERVER_I_DN_OU

    SSL-Server-I-DN-OU

    SSL_CLIENT_I_DN_CN

    SSL-Client-I-DN-CN

    SSL_SERVER_I_DN_CN

    SSL-Server-I-DN-CN

    SSL_CLIENT_I_DN_T

    SSL-Client-I-DN-T

    SSL_SERVER_I_DN_T

    SSL-Server-I-DN-T

    SSL_CLIENT_I_ DN_I

    SSL-Client-I-DN-I

    SSL_SERVER_I_DN_I

    SSL-Server-I-DN-I

    SSL_CLIENT_I_DN_G

    SSL-Clien t-I-DN-G

    SSL_SERVER_I_DN_G

    SSL-Server-I-DN-G

    SSL_CLIENT_I_DN_S

    SSL-Client-I-DN-S

    SSL_S ERVER_I_DN_S

    SSL-Server-I-DN-S

    SSL_CLIENT_I_DN_D

    SSL-Client-I-DN-D

    SSL_SERVER_I_DN_D

    S SL-Server-I-DN-D

    SSL_CLIENT_I_DN_UID

    SSL-Client-I-DN-Uid< /code>

    SSL_SERVER_I_DN_UID

    SSL-Server-I-DN-Uid

    SSL-Client-I-DN-Email

    SS L_SERVER_I_DN_Email

    SSL-Server-I-DN-Email

    SSL_CLIENT_A_SI G

    SSL-Client-A-Sig

    SSL_SERVER_A_SIG

    SSL-Server-A-Sig

    SSL_CLIENT_A_KEY

    SSL-Client-A-Key

    SSL_SERVER_A_KEY

    < a name="1054523">

    SSL-Server-A-Key

  3. mod_certheaders can be used to instruct Oracle HTTP Server to treat certain requests as if the y were received through HTTPS even though they were received through HTTP. This is useful when Oracle HTTP Server is front-ended by a reverse proxy or load balancer, which acts as a termination point for SSL requests, and forwards the requests to Oracle HTTP Server through HTTPS.

    For load balancers, mod_certheaders must be explicitly conf igured to determine which requests should be treated as HTTPS requests. To do this, use the following directive:

    SimulateHttps on
    
    

    SimulateHttps can be embedded within a virtual host, such as:

    <VirtualHost localhost:7777>
        SimulateHttps on
        .
        .
        .
    </VirtualHost>
    
    

    This tells mod_certheader s to treat every request handled by this virtual host as HTTPS, or the directive can be placed within a <LocationMatch>, <Directory>, or <DirectoryMatch> directive container such as:

    <
    Location /foo/>
        SimulateHttps on
    </Location>
    
    

    This limits it to URLs starting with /foo/.

< !--TOC=h1-"1025766"-->

mod_cgi

Enables the server to run CGI scripts.

See Also:

Module mod_cgi in the Apache Server documentation.

mod_define

Enables the Define directive, which defines a variable that can be expanded on any configuration line. The Define directive has the status Extension, which means that it is not compi led into the server by default.

This module requires the Extended API (EAPI). Oracle HTTP S erver always has EAPI-enabled.

This module is available on UNIX systems only.

mod_digest

Uses an older version of the MD5 Digest Authentication specification than that used in mod_auth_digest to provide user authentication. mod_digest proba bly only works with older browsers.

See Also:

Module mod_digest in the Apache Server documentation.

mod_dir

Enables the server to perform slash (/) redirects. Directories must contain a trailing slash. If a request for a URL without a trailing slash is received, mod_dir redirects the request to the same URL followed by a trailing slash. For example:

http://myserver/documents/mydirectory

is redirected to

http://myserver/documents/mydirectory/


See Also: Module mod_dir in the Apache Server documentation.

mod_dms

Enables you to monitor performance of site components with Oracle's Dynamic Monitoring Service (DMS).

See Also:

Oracle Application Server 10g P erformance Guide

mod_env

Enables you to control the environment for CGI scripts and SSI (Server Side Includes) pages by passing, setting, and unsetting environment varia bles.

< td class="NoteAlso">See Also:

Module mod_env in the Apache Server docum entation.

mod_example

Provides examples and g uidance on how to write modules using the Apache API. When implemented, it demonstrates module callbacks triggered by the server.

This module is not supported by Oracle.

mod_expires

Enables the server to generate Expires HTTP headers, which provide information to the client about document validity. D ocuments are served from the source if, based on the expiration criteria, the cached copy has expired.

See Also:

Module mod_expires in the Apache Server documentation.

< /div>

mod_fastcgi

Supports the FastCGI protocol, which enables you to mai ntain a pool of running servers for CGI applications, thereby eliminating start-up and initialization overhead.

See Also:

Module mod_fastcgi in the Apache Server docum entation.

mod_headers

Enables you to merge, r eplace, or remove HTTP response headers.

See Also:

Module mod_header s in the Apache Server documentation.

< h2 class="H1">mod_imap < p class="BP">Enables server-side image map processing.

This module is not supported by Orac le.

mod_i nclude

Provides a filter that processes documents for SSI (Server Si de Includes) directives.

See Also:

Module mod_include in the Apache Server documentation.

mod_info

Sum marizes the entire server configuration, including all installed modules and directive settings.

See Also:

Module mod_info in the Apache Server documentation.

mod_isap i

Enables serving of Internet Server extensions (such as .dll< /code> modules).

It is available on the Windows platform only, and is not supported by Orac le.

mod_l og_agent

Enables logging of client user agents. It is deprecated; yo u should use mod_log_config instead of mod_log_agent.

This module is not supported by Oracle.

mod_log_config

Provides configurable, customizable logging of server activities. You can choose the log format, and select or exclude individual r equests for logging, based on characteristics of the requests.

See Also:

M odule mod_log_config in the Apache Server documentation.

mod_log_referer

Enables logging of documents that reference documents on the server. It is deprecated; y ou should use mod_log_config instead of mod_log_referer.

< table class="NoteAlso" border="0" width="80%" cellpadding="0" cellspacing="0" dir="ltr" summary="This is a layout table to format a n ote" title="This is a layout table to format a note"> See Also:

Module mod_log_referer in the Apache Server documentation.

mod_mime

Enables the server to determine the type of a file from its filename, and associate files with handlers for processing.

See Also:

Module mod_m ime in the Apache Server documentation.

mod_mime_magic

Enables the server to determine the MIME type of a file by examining a few bytes of its content. It is used in c ases when mod_mime cannot determine a file type. Make sure that mod_mime appears before mod_mime_magic in the configuration file, so that mod_mime processes the files first.

< a name="1013165">
See Also:

Module mod_mime_magic in the Apache Server documenta tion.

mod_mmap_static

Maps a list of files in to memory, useful for frequently requested files that are not changed often.

This module is not supported by Oracle.

mod_negotiation

Enables the server for content nego tiation (selection of documents based on the client's capabilities).

See Also:

Module mod_negotiation in the Apache Server documentation.

mod_onsint

This module provides integration support with Oracle Notification Service (ONS) and OP MN (Oracle Process Manager and Notification Server).

Benefits of mod_onsint

< code>mod_onsint provides the following functionality:

  • P rovides a subscription mechanism for ONS notifications within Oracle HTTP Server. This is particularly important on UNIX where Oracle HTTP Server employs a multi-process architecture. In such an architecture, it is not feasible to have an ONS subscriber in each proc ess since there are up to 8192 processes that comprise a single Oracle HTTP Server instance. Instead, mod_onsint provide s a single process that receives notification for all modules within an Oracle HTTP Server instance.
  • Publishes PROC_READY ONS notifications so that other components such as OPMN are notified that th e listener is up and ready. It also provides information such as DMS metrics and information about how the listener can be contacted. These notifications are sent periodically by mod_onsint as long as the Oracle HTTP Server instance is running.
  • Provides functionality that enables Oracle HTTP Server to terminate as a single unit i f the parent process fails. The parent process is responsible for starting and stopping all of the child processes for an Oracle HTTP Server instance. The failure of the parent process without first shutting down the child processes leaves Oracle HTTP Server in an i nconsistent state that can only be fixed by manually killing all of the orphaned child processes. Until this is done, a new Oracle HT TP Server instance cannot be started since the orphaned child processes still occupy the ports Oracle HTTP Server wants to use. mod_onsint provides a monitor of the parent process. If it detects that the parent process has died, it kills all of the rema ining child processes. When combined with OPMN, this provides restartability for Oracle HTTP Server in the case of a parent process f ailure. mod_onsint ensures that all of the Oracle HTTP Server child processes die, leaving the ports open for a new Orac le HTTP Server instance. OPMN ensures that a new instance is started once the failure of the original instance is detected.

Implementati on Differences for mod_onsint

Due to the difference in architecture of Oracle HTTP Server on UNIX and Windows, the implementation of mod_onsint varies slightly on these platforms.

On UNIX, mod_onsint spawns a process at module initialization time. This process is re sponsible for watching the parent process as well as sending and receiving ONS messages. Callback functions from other modules intere sted in ONS notifications are made in this process. For this information to be shared with other Oracle HTTP Server child processes, the use of an interprocess communication method such as a memory mapped file must be used. If a failure of a parent process is detect ed on UNIX, a signal is sent to all the other child processes, causing them to shut down.

O n Windows, Oracle HTTP Server consists of only two processes, the parent and a multi-threaded child that handles all of the HTTP requ ests. In this model, mod_onsint runs as a thread within the child process. This thread watches the parent process as wel l as sending and receiving ONS messages. Callback functions from other modules interested in ONS notifications are made in the child process. If a failure of the parent process is detected, the mod_onsint terminates the child process, effectively shutti ng down Oracle HTTP Server.

< tr class="NoteAlso">
See Also :

"Oracle HTTP Server Processing Model"

There is no configuration of mod_onsint needed to provide functionality equivalent to that provided with Oracle HTTP Server in Oracle9i Application Server, Release 2 (9.0.2), other than the loading of the module. There is only an optional directive called OpmnHostPort that can be set. This directive enables you to specify a hostname and port that OPMN should use for pinging t he Oracle HTTP Server instance that mod_onsint is running in. If OpmnHostPort is not specified, mod_o nsint chooses an HTTP port automatically. However, in certain circumstances, you may want to choose a specific HTTP port and h ostname that OPMN should use to ping the listener with.

OpmnHostPort takes a s ingle argument which is a host:port string that specifies the values to pass to OPMN. For example, the following line wo uld specify that OPMN should use the localhost interface and port 7778 to ping this listener:

<
/a>OpmnHostPort localhost: 7778

This directive must be in the glo bal section of the httpd.conf file. It cannot be embedded into any virtual host of loc ation container. After installation, an OpmnHostPort directive is located in dms.con f. It points OPMN to the Oracle HTTP Server "diagnostic port", which is a special localhost only virtual host.

You cannot combine directives using the one-argument syntax with directives using the two-argument syn tax. If you use the two-argument syntax, the default for groups without a group-specific secret key is 'disabled'.

mod_ossl

This Oracle module enables strong cryptography for Oracle HTTP Server. It is a plug-in to Oracle HTTP Server that enables the server to use SSL. It is very similar to the OpenSSL module, mod_ssl. However, i n contrast to the OpenSSL module, mod_ossl is based on the Oracle implementation of SSL, which supports SSL, version 3, and is based on Certicom and RSA Security technology.

< strong class="NH">See Also:

mod_perl

This module embeds the Perl interpreter into the Oracle HTTP Server. This eliminates start-up overhead and enables you to wri te modules in Perl.


Note:

The demonstration script for this module that is shipped with Oracle Database should be disable d in production environments. It is included only to verify that the installation was successful.


See Also:

mod_perl Guide

Database Usage Notes

This section provides info rmation for mod_perl users working with databases. It explains how to test a local database connection and set character forms.

U sing Perl to Access the Database

The following section contains info rmation about using Perl to access the database. Perl scripts access databases using the DBI/DBD driver for Oracle. The DBI/DBD drive r is part of Oracle Database. It calls Oracle Callable Interface (OCI) to access the databases.

DBI must be enabled in httpd.conf for DBI to function. To do this, perform the fo llowing steps:

  1. Edit httpd.conf us ing a text editor.
  2. Search for "PerlModule Apache: :D BI".
  3. Uncomment the line "PerlModule Apache: : DBI".
  4. Restart Oracle HTTP Server using the following commands:

Files must be copied to ORACLE_HOME/Apache/Apache/cgi-bin

Examp le 7-1 Using Perl to Access the Database

#!<ORACLE_HOME<
/em>>perl/bin/perl -w 
  use DBI; 
  my $dataSource = "host=<hos
tname.domain>;sid=<orclsid>;port=1521"; 
  my $userName = "scott"; 
  my $password = "tiger"; 
  my $dbhandle = DBI->connect("dbi:Oracle:$dataSource", $userNam
e, $password) 
    or die "Can't connect to the Oracle Database: $DBI::errstr\n"; 
  prin
t "Content-type: text/plain\n\n"; 
  print "Database connection successful.\n"; 
  ### No
w disconnect from the database 
  $dbhandle->disconnect 
    or warn "Database disconn
ect failed; $DBI::errstr\n"; 
  exit;

You c an access the DBI scripts from the following locations:

http://<hostn
ame.domain>:<port>/cgi-bin/<scriptname>
htt
p://<hostname.domain>:<port>/perl/<scriptname&
gt;

If the script specifies "use Apache::DBI" instea d of "use DBI", then it will only be able to run from http://<hostname.domain>:<port>/perl/<scriptname>.

Testing Databas e Connection

The following is a sample Perl script for testing the d atabase connection of a local seed database. To use the script to test another database connection, you must replace scott/tige r with the user name and password for the target database.

Example 7-2 Sample Perl Script For Testing Connection for Local Seed Database

##### Perl script start ###### 
use DBI;
print "Content-type: text/
plain\n\n"; 
$dbh = DBI->connect("dbi:Oracle:", "scott/tiger", "") || die $DBI::errstr;
 $stmt = $dbh->pr
epare("select * from emp order by empno")|| die $DBI::errstr; 
$rc = $stmt->execute() || die $DBI::errstr; 
while (($empno, $name) = $stmt->fetchrow()) { print "$empno $name\n"; } 
warn $DBI::er
rstr if $DBI::err; 
die "fetch error: " . $DBI::errstr if $DBI::err; 
$stmt->finish()
|| die "can't close cursor"; 
$dbh->disconnect() || die "cant't log off Oracle"; 
####
# Perl script End ###### 

Using SQL NCHAR Datatypes

SQL NCHAR datatypes have been refined in Oracle9i, and are now called reliable Unicode datatypes. S QL NCHAR datatypes such as NCHAR, NVARCHAR2 and NCLOB allow you to store a ny Unicode characters regardless of the database character set. The character set for those datatypes is specified by the national ch aracter set, which is either AL16UTF-16 or UTF8.

See Also:

Oracle9i documentation for more about SQL NCHAR datatypes.

This rel ease of DBD::Oracle supports SQL NCHAR datatypes and provides driver extension functions to sp ecify the character form for data binding. The following script shows an example to access SQL NCHAR data:< /p>

Example 7-3 Sample Script to Access SQLNCHAR Data

# declare to use the constants for character forms
use DBD::Oracle qw(:ora_forms);
# connect to the database and get the database handle
$d
bh = DBI->connect( ... );
# prepare the statement and get the statement handle
$sth =
$dbh->prepare( 'SELECT * FROM TABLE_N WHERE NCOL1 = :nchar1' );
# bind the parameter of a NCHAR type
$sth->bind_param( ':nchar1', $param_1 );
# set the character form to NCHAR

$sth->func( { ':nchar1' => ORA_NCHAR } , 'set_form' );
$sth->execute;

As shown in Example 7-3, the set_form function is provided as a private function that you can invoke with the standard DBI func() method. It takes an anonymous hash that specifies which placeholder should be associated with which character form. The valid va lues of character form are either ORA_IMPLICIT or ORA_NCHAR. Setting the character form to ORA_IMPLIC IT causes the application's bound data to be converted to the database character set, and ORA_NCHAR to the nation al character set. The default form is ORA_IMPLICIT.

Another function is provid ed to specify the default character set form as follows:

# specify the default form to be N
CHAR
$dbh->func( ORA_NCHAR, 'set_default_form' );

After this call is made, the form of all parameters is ORA_NCHAR, unless otherwise specified with set_fo rm calls. Note that unlike the set_form function, this is a function on the database handle, so every statement f rom the database handle with its default form specified has the form of your choice by default.

set_form

This function sets the character form for parameter(s). Valid forms are either ORA_IMPLICIT (default) or ORA_NCHAR. The constants are available as: ora_forms in DBD::Oracle.

Example 7-4 Sample for set_form

# a declaration example for the constants ORA_IMPLICIT and ORA_NCHAR
use DBD::Or
acle qw(:ora_forms);
# set the character form for the placeholder :nchar1 to NCHAR
$sth-&
gt;func( { ':nchar1' => ORA_NCHAR } , 'set_form' );
# set the character form using the positional index
$sth->func( { 2 => ORA_NCHAR } , 'set_form' );
# set the character form for multiple pl
aceholders at once
$sth->func( { 1 => ORA_NCHAR, 2 => ORA_NCHAR } , 'set_form' );

set _default_form

This function sets the default character form for a da tabase handle.

Example 7-5 Default Character Form for a Database Handle

$dbh->func( ORA_NCHAR , 'set_default_form' );
<
a name="1014746">

mod_plsql

This Oracle module connects the Oracle HTTP Server to an Oracle database, enabling you to create Web applications using Oracle stored procedures.

In order to access a Web-enabled PL/SQL application, configure a PL/SQL Database Access Descripto r (DAD) for mod_plsql. A DAD is a set of values that specifies how mod_plsql connects to a database server to fulfill an HTTP request. Besides the connect details, a DAD contains important configuration parameters for various operations in the database and for mod_plsql in general. Any Web-enabled PL/SQL application which makes use of the PL/SQL Web ToolKit needs to create a DAD to invoke the application.

  • Any PL/SQL Ap plication written using the PL/SQL Web ToolKit
  • Oracle Application Server Porta l

C reating a DAD

Perform the following steps to create a DAD:

  1. Edit the DAD configuration file ORACLE_HOME/Apache/modplsql/conf/dads.conf.
  2. Add a DAD where the DAD has the following format:
    1. The Oracle HTT P Server <Location> directive which defines a virtual path used to access the PL/SQL Web App lication. This directive begins enclosing a group of directives that apply to the named Location.

      For example, the directive <Location /myapp> defines a virtual path called "/myapp" that will be used to invoke a PL/SQL Web Application through a URL like http://host:port/myapp/.


      Note:

      Older versions of mod_plsql were always mounted on a virtual path with a prefix of '/pls'. This restriction is removed in newer versions but might still be a restriction imposed by some of the older PL/SQL applications.


    2. The Oracle HTTP Server "SetHandler" directive which directs Oracle HTTP Server to enable mod_plsql to handle the request for the virtual path defined by the named Location
      SetHandler pls_handler
      
      
    3. Additional Oracle HTTP Server directives that are allowed in the context of a <Location> directive. Ty pically, the following directives are used:
      Order deny,allow
      Allow from
       all
      AllowOverride None
      
      
    4. One or more mod_plsql specific directives. For example:
      PlsqlDatabaseUsername
       scott
      PlsqlDatabasePassword        tiger
      PlsqlDatabaseConnectString   orcl
      PlsqlAuthenticationMode      Basic
      
      
    5. An Ora cle HTTP Server </Location> directive which closes the group of directives for the named Location, an d defines a single DAD.
  3. Save the edits.
  4. Obfuscate the DAD password by running the "dadTool.pl" script located in ORACLE_HOME/Apache/modplsql/conf.

    See Also:

    "PlsqlDa tabasePassword" for instructions on performing the obfuscation.

  5. Restart the Oracle HTTP Server for the configuration to take effect.

You can create additional DADs by defining other uniquely named Locations in dads.conf.

This section contains the following topics:

Configuration Files

Configuration Parameters

Configuration Files

mod_pls ql configuration reside in the following three configuration files:

The following section discusses the following parameters that can be specified in plsql.conf: