mod_ossl Oracle Fusion Middleware Online Documentation Library

Understanding Oracle HTTP Server Modules 3-5

3.7 mod_osso

The mod_osso module enables single sign-on for Oracle HTTP Server by examining incoming requests and determining whether the requested resource is protected. If it is, then it retrieves the Oracle HTTP Server cookie. The module is disabled, by default. To enable the mod_osso module, follow the instructions in Section 4.4.5, Enabling the mod_osso Module .

3.8 mod_perl

The mod_perl module embeds the Perl interpreter into Oracle HTTP Server. This eliminates start-up overhead and enables you to write modules in Perl. Oracle Fusion Middleware uses Perl version 5.10. The module is disabled, by default. To enable the mod_perl module, follow the instructions in Section 4.4.3, Configuring the mod_perl Module .

3.8.1 Using mod_perl with a Database

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

3.8.1.1 Using Perl to Access the Database

Perl scripts access databases using the DBIDBD driver for Oracle. The DBIDBD driver is part of Oracle Fusion Middleware. It calls Oracle Call Interface OCI to access the databases. Once mod_perl is enabled, DBI must be enabled in the mod_perl.conf file to function. To enable DBI, perform the following steps: 1. Edit the mod_perl.conf file: a. In Fusion Middleware Control, navigate to the Oracle HTTP Server Advanced Configuration page.

b. Select the mod_perl.conf file from the menu and click Go.

c. Add the following line to the mod_perl.conf file: PerlModule Apache::DBI

2. Click Apply to save the file.

3. Restart Oracle HTTP Server using Fusion Middleware Control. Place the Perl scripts that you want to run in the ORACLE_ INSTANCE configOHSohs_namecgi-bin directory. Example 3–1 Using a Perl Script to Access a Database ORACLE_HOMEperlbinperl -w See also: For information about forced authentication, see Oracle Fusion Middleware Application Developers Guide for Oracle Identity Management. For information about single sign-on, see Oracle Fusion Middleware Security Guide See Also: mod_perl Guide 3-6 Oracle Fusion Middleware Administrators Guide for Oracle HTTP Server use DBI; my dataSource = host=hostname.domain;sid=orclsid;port=1521; my userName = userid; my password = password; my dbhandle = DBI-connectdbi:Oracle:dataSource, userName, password or die Cant connect to the Oracle Database: DBI::errstr\n; print Content-type: textplain\n\n; print Database connection successful.\n; Now disconnect from the database dbhandle-disconnect or warn Database disconnect failed; DBI::errstr\n; exit; To run the DBI scripts, the URLs would look like the following: http:hostname.domain:portcgi-binscriptname http:hostname.domain:portperlscriptname If a script specifies use Apache::DBI instead of use DBI, then it can only run from the URL http:hostname.domain:portperlscriptname.

3.8.1.2 Testing a Database Connection

Example 3–2 shows a sample Perl script for testing a database connection. Replace the instance name, userid, and password in the connect statement with proper values for the target database. Example 3–2 Sample Perl Script For Testing Connection for Local Seed Database use DBI; print Content-type: textplain\n\n; dbh = DBI-connectdbi:Oracle:instance_name, useridpassword, || die DBI::errstr; stmt = dbh-prepareselect 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::errstr if DBI::err; die fetch error: . DBI::errstr if DBI::err; stmt-finish || die cant close cursor; dbh-disconnect || die cantt log off Oracle;

3.8.1.3 Using SQL NCHAR Data Types

SQL NCHAR data types NCHAR, NVARCHAR2 and NCLOB are reliable Unicode data types. SQL NCHAR data types enable you to store Unicode characters regardless of the database character set. The character set for those data types is specified by the national character set, which is either AL16UTF-16 or UTF8. Example 3–3 shows an example of accessing SQL NCHAR data. Example 3–3 Sample Script to Access SQL NCHAR Data declare to use the constants for character forms use DBD::Oracle qw:ora_forms; connect to the database and get the database handle dbh = DBI-connect ... ; prepare the statement and get the statement handle