Displaying Oracle Reports on the Web

Displaying Oracle Reports on the Web

Oracle Forms requires the most work before moving to a web-deployment. Moving Oracle Reports and Oracle Discoverer worksheets to the Web are relatively simple in comparison. As with Oracle Forms, Oracle provides a compiler for Oracle Reports included with every installation of Oracle Application Server 10 g . On Windows, it can be found in Start -> Programs -> Oracle <Oracle_HOME> -> Reports Services -> Reports Converter (see Figure 6-9). On Unix, you can run the rwconverter.sh script.

click to expand
Figure 6-9: The Reports converter executable

There are two main types of Reports files you can generate from Oracle Reports Developer: Reports Binary files (.rdf) and Report Binary Run-only files (.rep). RDFs for Reports are equivalent to FMBs for Forms and REPs are equivalent to FMXs for Forms in the sense that .REPs and FMXs are platform specific (i.e., an .rep of FMX developed on, say, a Windows machine cannot be moved to a Linux machine and executed there) while RDFs and FMBs are not. There is a crucial difference, however, between the Forms and Reports Servers included with Oracle Application Server 10 g : the Forms Server requires FMXs; the Reports Server can run RDFs with no problems. What this implies for the developer is that a Form developed on one platform MUST be recompiled before deploying on a different platform; Reports, however, can be developed on one platform and deployed on another without recompilation. As is the case of Forms, the Oracle Application Server 10 g Reports Server can serve Reports via the Web developed with Reports 6 i onward without modification.

Tip  

Just like Forms, it s a good idea to recompile your Reports on your production server just to make sure there are no anomalies.

Reports and Fonts

Perhaps the biggest issue to consider when moving reports to the Web involves the fonts used in the Reports. The Reports Server will use the character set on the server displaying the Reports, which may have a different character set than what is on your development machine(s). During Report formatting, fonts associated with the layout objects are first checked against the font alias file, uifont.ali. If an entry in the font alias file is found, the mapped font is used instead of the original one. The mapped font is then looked up in the list of fonts available on the system or printer. If a particular font is not found, Oracle Reports will look for the nearest matching font under the same character set that can be used instead.

On Windows, the font lookup mechanism is simple due to the availability of printer drivers, which have the capability of uploading fonts from the system as needed. Oracle Reports considers both the printer and the system fonts when looking for the available fonts. On Unix, the fonts available for generating output are either one of the following: the fonts available on the printer, specifically the fonts defined in the PPD or TFM files if no printer is specified, or the fonts available in the ScreenPrinter file, screenprinter.ppd.

The following steps describe how Oracle Reports generates a list of the available fonts for generating output (e.g., for the screen, printer, or file):

  • Oracle Reports looks in the printer configuration file uiprint.txt for all the printers that are listed for the application. If no printers are defined or available, Oracle Reports uses ScreenPrinter.

  • Oracle Reports gets their type, version, and printer definition file.

  • Oracle Reports checks for the existence of these printers in the system.

  • If the printers are present, the printer definition files are loaded and the information in these files is read along with the information related to the fonts available for the printer. If these printers are not found, then Oracle Reports uses ScreenPrinter.

  • The AFM files (Adobe Font Metric ”used to provide information on Adobe fonts), which are named the same as the font names given in the PPD files, are searched.

  • If found, Oracle Reports then reads the AFM files for all the valid keywords, checks for their correctness and, in case of any discrepancy, default values are used for those keywords.

  • If the AFM file is not found, Oracle Reports marks the font as unusable.

Substituting Fonts

If a particular font is needed but not found in the PPD file or if an AFM file is not found, Oracle Reports will look for the nearest matching font according to its matching rules. If it cannot find any matching font for this character set, Oracle Reports searches for a font that has a character set for the environment in which the application is running. After finding a set of fonts with a similar character set, Oracle Reports picks the closest match to the requested font based on the font weight, style, etc. If more than one font has the same parameters, Oracle Reports picks the first one and uses it instead of the original font.

Font Matching Rules

When attempting to match a font, Oracle Reports will try to find the closest match according to the following criteria for fonts with the same character set:

fontface > fontsize > fontstyle > fontweight > fontwidth

If Oracle Reports can t match the font face, it will try to match the font size; if it can t match the size, it will try to match the font style; and so on. If a font matches the font size but nothing else and another font matches the style, weight, and width but not the font size, then Oracle Reports will pick the font with the same font size . It should be noted that irrespective of any font in the output file, the final printed output will depend solely on the fonts installed in the printer.

Because a report may have to run in many different environments, Oracle Reports always tries to approximate a font for the original font when the original is unavailable. This algorithm is not entirely foolproof. When you create a report, you must be aware of the fonts defined and you should always consider whether those same fonts will be available on the platform where users will run the report. If the font that you have defined is not available in the run-time environment, Oracle Reports substitutes another font that is available on the machine. This process can lead to unexpected and undesirable results, such as strange characters in the report output and incorrect formatting of objects. If you are encountering these kinds of problems, you should use font aliasing to control the font substitutions made by Oracle Reports. Oracle Reports follows the preceding described mechanisms for all output file generation except PDF, which has the PDF font sub setting/embedding capabilities.

Printing

For printing, Oracle Reports generates output based upon the printer driver, in the case of Windows, or the printer, in the case of Unix. On Windows, the output generation is handled by the printer driver. The fonts in this case can either be from the system or from the printer. For fonts that are not available on the printer, the printer will get the fonts from the system through Windows Application Programming Interfaces (APIs).

Font Configuration Files

The following list describes all of the files associated with font configuration for Oracle Reports.

  • uiprint.txt (Unix only)

    The printer configuration file contains a list of printers installed for the application along with the type of printer, its version, and the printer definition file. The list of available fonts for run time is taken from the printer definition file. If no printer is present, Oracle Reports chooses a PostScript printer as the default and default.ppd file as the printer definition file.

  • screenprinter.ppd (Unix only)

    screenprinter.ppd is used when a printer is not available on Unix. screenprinter.ppd is in ORACLE_HOME/guicommon9/tk90/admin/PPD.

  • uifont.ali

    This file contains mapping information for fonts which can be substituted for other fonts at run time. Oracle Reports has added three new sections to the uifont.ali file:

    • [PDF] Used for font aliasing and multibyte language support

    • [PDF:Subset] Used for TrueType font subsetting and multibyte language support

    • [PDF:Embed] Used for Type1 font embedding

  • PPD and AFM files (UNIX only)

PostScript Printer Definition (PPD) files and AFM files are supplied by Adobe and by printer vendors . These files contain information about the printer. Along with other parameters, these files are read for the information about the available fonts for the printer, which Oracle Reports will use. For all the fonts listed in the PPD file, Oracle Reports searches for the corresponding AFM file according to the font name and loads all of the fonts for which there is an available AFM. From the fonts perspective, you should modify these files when you add new fonts for the printer and want these changes reflected in Oracle Reports. The AFM files contain information such as the font attributes (style, weight, width, encoding scheme), whether the font is fixed pitch or proportional, and how large each character is. After looking for the font names from the PPD files, Oracle Reports searches for the AFM files with the same name as the font.AFM files are NOT font files; they are metrics files, which give Oracle Reports information on how to properly format the character for the printer. If you have an AFM file, but the font is not available on the printer, then Oracle Reports cannot generate the font. Because the AFM files are NOT fonts themselves , if you wish to have more PostScript printer fonts available, you need to:

  • Purchase the fonts and have them installed on the printer

  • Obtain revised AFM and PPD files from the font/printer vendor

  • Obtain matching X Server display fonts (if necessary)

Running an Oracle Report on the Web

Oracle Reports uses a Reports Server to serve up reports to your browser over the Web. You can have multiple Reports Servers running simultaneously , each with different characteristics depending on the nature of reporting in your company. During the installation of Oracle Application Server 10 g , a Reports Server is created for you automatically. It is given the name rep_< servername > and can have its status checked in the Enterprise Manager Application Server Control web site for the middle tier . Unlike the Forms Server we discussed earlier, the Reports Server has no dependencies and can be started or stopped independently.

As with Oracle Forms, there is an easy way to display your Reports on the Web, but it is for illustrative purposes only ”you would not use this method in a production environment. The rwservlet executable is used to serve Oracle Reports over the Web. Its URL format is:

 http://<host>:<port>/reports/rwservlet?<parameters> 

A typical Reports URL might look like this:

 http://xpas10g:7778/reports/rwservlet?destype=cache&desformat=PDF&report=test. rdf&userid=chris/viewonly@test&repserver=rep_xpas10g 

This is not a good way to do it because of the same issue we discussed earlier with Forms: namely, that too much Reports implementation and database information is exposed in the URL for all to see. For Forms, Oracle provides the Forms Servlet Configuration File (formsweb.cfg) to hide Forms implementation details. For Reports, Oracle provides a similar file but its naming and format are different.

cgicmd.dat

The cgicmd.dat file is referred to in Oracle documentation as the Key Map file. It is located in the $ORACLE_HOME/reports/conf directory, and it performs a similar role for Reports that the formsweb.cfg file provides for Forms. Its format is slightly different:

<key>:<parameters>

The preceding request to run the Report:

 http://xpas10g:7778/reports/rwservlet?destype=cache&desformat=PDF&report=tes t.rdf&userid=chris/viewonly@test&server=rep_xpas10g 

can have its details hidden like this in the cgicmd.dat file:

 test_report: destype=cache desformat=PDF report=test.rdf userid=chris/ viewonly@test server=rep_xpas10g 

Note that parameters are separated by blank spaces and NOT ampersands as with the URL. To reference this key, simply specify it at the end of your URL:

 http://xpas10g:7778/reports/rwservlet?test_report 

The rwservlet executable can accept numerous parameters, the most common of which are described as follows (for a complete list, refer to Oracle Application Server Reports Services Publishing Reports to the Web 10g (9.0.4), Part Number B10314-01):

  • ARRAYSIZE Use ARRAYSIZE to specify the size (in kilobytes) for use with Oracle9 i array processing. Generally, the larger the array size, the faster the report will run.

  • BLANKPAGES Use BLANKPAGES to specify whether to suppress blank pages when you print a report. Use this keyword when there are blank pages in your report output that you do not want to print.

  • BUFFERS Use to specify the size of the virtual memory cache in kilobytes. You should tune this setting to ensure that you have enough space to run your reports, but not so much that you are using too much of your system s resources.

  • COPIES Use to specify the number of copies of the report output to print.

  • DATEFORMATMASK Use to specify how date values display in your delimited report output.

  • DESFORMAT Use DESFORMAT to specify the format for the job output and to specify the printer driver to be used when DESTYPE is FILE and DESNAME=filename. The values are listed in Table 6-5.

Table 6-5: Values for the DESFORMAT parameter

Value

Description

DELIMITED

The report output is sent to a file that can be read by standard spreadsheet utilities, such as Microsoft Excel. If you do not specify a delimiter (via the DELIMITER keyword), the default delimiter is a TAB. See Usage Notes.

DELIMITEDDATA

Provides the same functionality as DELIMITED, and is used when you have problems running large volume reports with DESFORMAT=DELIMITED. See Usage Notes.

HTML

This report output is sent to a file that is in HTML format.

HTMLCSS

This report output is sent to a file that includes style sheet extensions.

PDF

This report output is sent to a file that is in PDF format and can be read by a PDF viewer, such as Adobe Acrobat. PDF output is based upon the currently configured printer for your system. The drivers for the currently selected printer are used to produce the output; you must have a printer configured for the machine on which you are running the report.

POSTSCRIPT

This report output is sent to a file that is in PostScript format.

PRINTER DEFINITION

If DESTYPE=FILE and DESNAME=<filename> then PRINTER DEFINITION is used to specify how to format the report. If MODE=BITMAP, specify the name of the printer. If MODE=CHARACTER, specify the character-mode printer definition file (.prt file), such as hpl, hplwide, dec, decwide, decland, dec180, dflt or wide. Ask your system administrator for a list of valid printer definitions.

RTF

The report output is sent to a file that can be read by word processors (such as Microsoft Word). When you open the file in Microsoft Word, you must choose View -> Page Layout to view all the graphics and objects in your report.

XML

This report output is saved as an XML file. This report can be opened and read in an XML-supporting browser, or your choice of XML viewing application.

  • DESNAME Use DESNAME to specify the name of the cache, file, printer, Oracle Application Server Portal, or e-mail ID (or distribution list) to which the report output will be sent.

  • DESTYPE Use DESTYPE to specify the type of device that will receive the report output. If you have created your own pluggable destination via the Oracle Reports Destination API, this is how the destination you created gets called. The values for DESTYPE are listed in Table 6-6.

Table 6-6: Values for the DESTYPE parameter

Value

Description

CACHE

Sends the output directly to the Reports Server cache.

LOCALFILE

Sends the output to a file on the client machine, synchronously or asynchronously.

FILE

Sends the output to the file on the server named in DESNAME.

PRINTER

Sends the output to the printer on the server named in DESNAME. You must have a printer that the Oracle Application Server Reports Services can recognize as installed and running.

MAIL

Sends the output to the mail users specified in DESNAME. You can send mail to any mail system that works with SMTP. Note: The configuration file rwbuilder.conf must include the pluginParam mailServer with the outgoing mail server name. This applies in both Windows and Solaris environments.

ORACLEPORTAL

Sends the output to Oracle Application Server Portal. Relevant keywords include EXPIREDAYS, ITEMTITLE, OUTPUTPAGE, PAGEGROUP, REPLACEITEM, SCHEDULE, STATUSPAGE.

FTP

Sends the output to the specified FTP server.

WEBDAV

Sends the output to the specified WebDAV URL so that the report can be published directly.

name_of_pluggable_destination

If you have created your own pluggable destination via the Oracle Reports Destination API, this is what you use to call the destination you created.

  • HELP Use HELP to display a help topic that lists the keywords you can use with the rwservlet command.

  • KILLJOBID Use KILLJOBID to kill a Reports Server job with the specified job ID n .

  • MODULEREPORT Use MODULE or REPORT to specify the name of the report to run.

  • ORIENTATION ORIENTATION controls the direction in which the pages of the report will print {DEFAULTLANDSCAPEPORTRAIT}.

  • PAGESTREAM PAGESTREAM enables or disables page streaming (pagination) for the report when formatted as HTML or HTMLCSS output, using the navigation controls set by either of the following:

    • The Page Navigation Control Type and Page Navigation Control Value properties in the Report Property Palette

    • PL/SQL in a Before Report trigger (SRW.SET_PAGE_NAVIGATION_HTML)

  • SERVER Use SERVER to specify the name of the Reports Server you want to use to run this report.

  • SSOCONN Use SSOCONN to specify one or more connect strings to use to connect to one or more data sources in a single sign-on (SSO) environment.

  • USERID Use USERID only if you re not using SSO. Use USERID to specify your Oracle user name and password, with an optional database name for accessing a remote database. If the password is omitted, then a database logon form opens automatically before the user is allowed to run the report.

Reports Server Configuration Files

There are several files that make up the configuration of the Reports Server. The two most prominent ones are the rwservlet.properties and rep_<server name>.conf files, both of which are located in the $ORACLE_HOME/reports/conf directory.

rwservlet.properties

Any parameter specified here applies to all Reports Servers running on that machine. There are many parameters that can be specified in this file (see Chapter 3, Configuring OracleAS Reports Services in Oracle Application Server Reports Services Publishing Reports to the Web 10g (9.0.4) , Part Number B10314-01). In the list below are those parameters most commonly specified:

  • SERVER_IN_PROCESS=YES

The in-process server is an instance that gets started through the Reports Servlet rwservlet, when the report is requested for the first time. By default (starting with Oracle9iAS R2 onward), when the Business Intelligence and Forms option is selected during installation, an in-process Reports Server is configured automatically and is named rep_<hostname>.This process is not listed in the process list of the OS. Hence, this service cannot be stopped/disabled as it can be done with a normal process. By specifying this to yes, you do not have to specify the server=<servername> parameter in either the URL calling the report or the cgicmd.dat file. The server specified in the SERVER parameter (discussed in the following text) will be used when the report is executed.

  • #SINGLESIGNON=YES

Even though it is commented out by default in the rwservlet.properties file, the default value for the SINGLESIGNON parameter is still yes. This allows administrators to take advantage of Oracle s SSO capabilities from within Oracle Reports. Why is this desirable?

Consider an organization where there are hundreds of reports run over the Web every day. Most likely, this organization has multiple databases. If one username and password is used to access a specific report, you run into the danger of having the username/password combination fall into the wrong hands. At best, in this scenario, there are now people with access to data on the reports that should not have it. At worst, a knowledgeable user can now gain access to your database with a ( potentially ) malicious tool such as SQL*PLUS. It also becomes impossible to trace the source of the leak, as anyone who has been given that username/password combination is a potential suspect.

A better solution would be a way to define database resources and grant them to users as they need them. This way a user is solely responsible for his/her password and, when a breach of security is detected , the individual s login can be quarantined without affecting all other users on the system.

This also makes it easier to track down the unauthorized user, as Oracle has monitoring tools that can pinpoint when and where a particular user accesses the system.

Oracle s SSO capabilities allow the creation of users who can access Oracle Application Server 10 g components such Oracle Reports and Oracle Portal. These users are not to be confused with database users ”no database user is created when these users are created ”they are stored in Oracle s Lightweight Directory Access Protocol (LDAP) implementation, Oracle Internet Directory.

This is where it gets a little confusing: Where is the LDAP data stored from Oracle Internet Directory? Why, in an Oracle database (the infrastructure instance), of course! The Oracle Internet Directory service stores encrypted LDAP data in tables in the database.

For each of these LDAP users, it is possible to create resources (database username/password/connection string combinations). This way, the end user only needs to log in once (and, therefore, only has to remember one password) and the person responsible for security in your organization can grant or revoke access to a report by defining or deleting resources. To create a single sign-on user, enter the URL of the Delegated Administration Service on your infrastructure machine:

 http:<server name>:<port name>/oiddas 

You will be presented with a screen like the one in Figure 6-10.

click to expand
Figure 6-10: The login screen for Oracle Internet Directory

Log in using the orcladmin username and the password you enter when creating the infrastructure instance (not the database instance) when installing Oracle Application Server 10 g . Click the Directory tab, then the Create button in the middle of the screen. Fill in the required fields at the top of the screen (see Figure 6-11), then click Resource Access Information on the top right of the screen to be taken to the bottom of the page (see Figure 6-12).

click to expand
Figure 6-11: The Create User screen
click to expand
Figure 6-12: The create resource section of the Create User screen

Click the Create button and enter a name for your database resource. Click Next and enter a username/password/connect string combination.

It can be confusing determining where the connect string specified when creating a database resource for a user is resolved. First of all, it is not resolved on the user s local machine, even though the Report is displayed there. The connect string is resolved where the report is executed, not displayed. Secondly, it is not resolved on the infrastructure server (or, in the case of a server with both infrastructure and middle tier on the same machine, it is not resolved in the ORACLE_HOME for the infrastructure). This confuses many administrators ”didn t we just log in to the infrastructure to define the user and the resource for that user? Yes, but again, this is not where the Report is actually executed ”the infrastructure is simply where we define and store the connection information for the resource. Finally, it is resolved on the middle tier (or, in the case of a server with both infrastructure and middle tier on the same machine, in the ORACLE_HOME for the middle tier). This means that the tnsnames.ora file on the middle tier is what will be used to attempt a connection to the database.

How do we take advantage of Oracle s single sign-on functionality? By first making sure the SINGLESIGNON parameter in the rwservlet.properties files is set to YES, and then by specifying the SSOCONN parameter in the URL calling the report. Here s the chain of events that happens when an end user requests a report through SSO:

  1. The user specifies a URL in their browser similar to this one:

     http://xpas10g:7778/reports/rwservlet?destype=cache&desformat=PDF&report= test.rdf&ssoconn=ssotest 

    or if there is an entry like this in the cgicmd.dat:

     ssotestkey: destype=cache desformat=PDF report=test.rdf ssoconn=ssotest 

    a URL like this:

     http://xpas10g:7778/reports/rwservlet?ssotestkey 
  2. The Reports Server determines that SSO has been enabled by reading the SINGLESIGNON parameter from the rwservlet.properties file and passes control to the infrastructure server. The user is then prompted for a login and password.

  3. If authentication is successful, control is passed back to the middle tier. Why the middle tier? The Reports Server checks for the existence of a resource for that user matching the name specified in the SSOCONN parameter in the URL (in this example, ssotest).

  4. The Reports Server then attempts to establish a connection to that database.

  5. If the connection is successful, the SQL in the report is executed, the results are returned to the Reports Server, and the report output is displayed in the end user s web browser.

Metalink note 222332.1, A Detailed Explanation of Oracle 9 i Reports Security, is an excellent primer for understanding the issues related to securing Oracle Reports on the Web. Even though it was written for Oracle 9 i Reports, the concepts are applicable to Oracle Reports 10 g .

  • SERVER=rep_oski

This is the server that is used when the SERVER_IN_PROCESS parameter is set to YES and no server is specified in either the URL or the cgicmd.dat Key Map file.

rep_ < server name > .conf

The rep_<server name>.conf file is an XML file that maintains information about Reports Servers on your system. Unlike the rwservlet.properties file, changes to this file will only affect the individual Reports Server. It can be very difficult to read (being an XML file), but the section below outlines the major sections of the file:

 <engine id="rwEng" class="oracle.reports.engine.EngineImpl" initEngine="1"  maxEngine="1" minEngine="0" engLife="50" maxIdle="30"  callbackTimeOut="60000"> 

This line specifies the basic characteristics of your Reports Server:

  • initEngine Specifies the number of Reports Server engines started when this Reports Server is started.

  • maxEngine and minEngine Specify the maximum and minimum engines used by this Reports Server.

  • engLife Specifies the number of jobs this Reports Server will process before shutting itself down and restarting itself (this is to attempt to avoid memory leaks).

  • maxIdle The number of minutes of allowable idle time before the engine is shut down, provided the current number of engines is higher than minEngine.

  • callbackTimeOut The number of milliseconds of allowable waiting time between when the server calls an engine and the engine calls the server back.

An optional parameter, although not listed in the example above, is the classPath attribute. This attribute of the engine element is used in any environment that uses the Java Importer. The value of this attribute represents the Java classpath used by the reports engine. All Java classes that are used in a report need to be found along this path . Any custom java class that is added to the REPORTS_CLASSPATH environment variable for use during design needs to be added to this attribute for deployment. The main difference between the REPORTS_CLASSPATH environment variable and the classpath attribute is that REPORTS_CLASSPATH contains all Java objects that are part of the reports services environment (data sources, destinations, other plug-ins, etc.), while the classpath attribute contains all the java objects that are used by Reports during execution ( barcode beans, etc.).

 <connection maxConnect="20" idleTimeOut="15"> 

MAXCONNECT must be equal to the SUM of your anticipated MAX CLIENT and MAX SERVER processes. For every client request on the Reports Server, the minimum number of connections required is two (2): one for the server and one for the client. If you anticipate or tune your Reports Server to handle a maximum of 20 engines, you must allow MAXCONNECT to be set to at least 40. idleTimeOut represents the maximum time of inactivity between a Reports client (e.g., RWCLIENT, RUN_REPORT_OBJECT, RWSERVLET) and the Reports Server. If a report contains SQL or PL/SQL, which takes a long time to execute on the RDBMS side, a REP-56109 timeout message may occur as a result of the idleTimeOut setting.



Oracle Application Server 10g Web Development
Oracle Application Server 10g Web Development (Oracle Press)
ISBN: 0072255110
EAN: 2147483647
Year: 2004
Pages: 192

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net