Anda di halaman 1dari 64

Tips and Techniques

Oracle Reports Even More


Hidden Treasures
Philipp Weckerle
Oracle Corporation

Tips & Techniques


Using OracleAS HA
with Oracle Reports

Adding Special Effects


to HTMLCSS Reports

Using Special Features


of Graphs

Handling Error Conditions


in Java Server Page (JSP)
Reports

Using OracleAS HA with Oracle


Reports

OracleAS HA and Reports


Server Clustering
OracleAS HA

Reliable
Resilient
Fault-tolerant
Common HA mechanism for all components

Reports Server Clustering

Deprecated in 10g Release 2 (10.1.2)


Need to migrate to OracleAS HA

HA Demonstration:
Architecture
OracleAS Web
Cache Standalone
Installation

HTTP

OracleAS Web Cache Site:


apps.mycompany.com
HTTP

host1.mycompany.com
host2.mycompany.com

Oracle Forms and


Reports Services
Installations

Database

HA Demonstration:
Nomenclature
HTTP(S)

Load Balancer

HTTP(S)
Origin Servers

Origin Server 1

Origin Server 2

Origin Server 3

Database

HA Demonstration:
Nomenclature
HTTP(S)

Load Balancer

HTTP(S)
Origin Servers

Origin Server 1

Origin Server 2

Origin Server 3

Database

Demonstration: Steps
Configuration
1.
2.
3.
4.
5.

Configure OracleAS Web Cache to Act Solely as a


Software Load Balancer
Configure Origin Servers
Create the Site Definition
Map the Site Definition to the Origin Servers
Direct All Requests Through the Load Balancer

Load balancing
Fail over

Configuration Step 1
Configuration
1.
2.
3.
4.
5.

Configure OracleAS Web Cache to Act Solely as a


Software Load Balancer
Configure Origin Servers
Create the Site Definition
Map the Site Definition to the Origin Servers
Direct All Requests Through the Load Balancer

Load balancing
Fail over

Configuration Step 1
HTTP
ORACLE_HOME\webcache\

OracleAS web Cache Site:

internal.xml

apps.mycompany.com

<LOADBALANCE ON="YES"/>
HTTP
Origin Servers
host1.mycompany.com

host2.mycompany.com

Database

Configuration Step 2
Configuration
1.
2.
3.
4.
5.

Configure OracleAS Web Cache to Act Solely as a


Software Load Balancer
Configure Origin Servers
Create the Site Definition
Map the Site Definition to the Origin Servers
Direct All Requests Through the Load Balancer

Load balancing
Fail over

Configuration Step 2
HTTP

OracleAS web Cache Site:


OracleAS Web Cache Manager

apps.mycompany.com

Origin Servers
HTTP

Origin Server details


Origin Servers

host1.mycompany.com
host2.mycompany.com

Database

Configuration Step 3
Configuration
1.
2.
3.
4.
5.

Configure OracleAS Web Cache to Act Solely as a


Software Load Balancer
Configure Origin Servers
Create the Site Definition
Map the Site Definition to the Origin Servers
Direct All Requests Through the Load Balancer

Load balancing
Fail over

Configuration Step 3
HTTP
OracleAS Web Cache Manager

OracleAS Web Cache Site:

Site Definitions

apps.mycompany.com

Web Cache host details


HTTP
Origin Servers
host1.mycompany.com

host2.mycompany.com

Database

Configuration Step 4
Configuration
1.
2.
3.
4.
5.

Configure OracleAS Web Cache to Act Solely as a


Software Load Balancer
Configure Origin Servers
Create the Site Definition
Map the Site Definition to the Origin Servers
Direct All Requests Through the Load Balancer

Load balancing
Fail over

Configuration Step 4
HTTP
OracleAS Web Cache Manager
Site-to-Server Mapping

OracleAS web Cache Site:

Apps.mycompany.com
host1.mycompany.com and
host2.mycompany.com

apps.mycompany.com
HTTP

Origin Servers
host1.mycompany.com
host2.mycompany.com

Database

Configuration Step 5
Configuration
1.
2.
3.
4.
5.

Configure OracleAS Web Cache to Act Solely as a


Software Load Balancer
Configure Origin Servers
Create the Site Definition
Map the Site Definition to the Origin Servers
Direct All Requests Through the Load Balancer

Load balancing
Fail over

Configuration Step 5
Multiple ways of achieving this, e.g.,

Protect origin servers with a firewall


Code the applications appropriately
Redirect requests from origin servers back to the
load balancer

Configuration Step 5
Multiple ways of achieving this, e.g.,

Protect origin servers with a firewall


Coding the applications appropriately
Redirect requests from origin servers back to the
load balancer

Configuration Step 5
HTTP
Enterprise Manager OracleAS
Control

OracleAS web Cache Site:


apps.mycompany.com

HTTP Server > httpd.conf


ServerName apps.mycompany.com

HTTP

Origin Servers
host1.mycompany.com
host2.mycompany.com

Database

Demonstration
Configuration
1.
2.
3.
4.
5.

Configure OracleAS Web Cache to Act Solely as a


Software Load Balancer
Configure Origin Servers
Create the Site Definition
Map the Site Definition to the Origin Servers
Direct All Requests Through the Load Balancer

Load balancing
Fail over

HTTP Request 1
HTTP

OracleAS web Cache Site:


apps.mycompany.com
HTTP
Origin Servers
host1.mycompany.com
host2.mycompany.com

Database

HTTP Request 1
HTTP

OracleAS web Cache Site:


apps.mycompany.com
HTTP
Origin Servers
host1.mycompany.com
host2.mycompany.com

Database

HTTP Request 2
HTTP

OracleAS web Cache Site:


apps.mycompany.com
HTTP
Origin Servers
host1.mycompany.com
host2.mycompany.com

Database

Demonstration
Configuration
1.
2.
3.
4.
5.

Configure OracleAS Web Cache to Act Solely as a


Software Load Balancer
Configure Origin Servers
Create the Site Definition
Map the Site Definition to the Origin Servers
Direct All Requests Through the Load Balancer

Load balancing
Fail over

One Origin Server Fails


HTTP

OracleAS web Cache Site:


apps.mycompany.com
HTTP
Origin Servers

host1.mycompany.com
host2.mycompany.com

Database

HTTP Request 1n
HTTP

OracleAS web Cache Site:


apps.mycompany.com
HTTP
Origin Servers

host1.mycompany.com
host2.mycompany.com

Database

Demonstration Summary
Set up HA for the OracleAS environment
Leverage OracleAS HA for Reports
Achieve Load Balancing and Fail Over

More Information
Oracle Application Server Best Practices
Guide 10g Release 2 (10.1.2)
Oracle Application Server High Availability
Guide 10g Release 2 (10.1.2)
Changed Functionality Between Oracle
Reports 6i and 10g

Using Special Features of


Graphs

Demonstration 1: Descending
Bars Use Case
Often data shows a drop in value, e.g.,

Drop in trade deficit


Drop in reported incidents of a disease
Drop in pulse rate due to meditation

To make graphs for such scenarios more


intuitive, the Y-axis baseline should be at the
top

Demonstration 1: Descending
Bars
1. Create Bar Graph

Demonstration 1: Descending
Bars
2. Shift the Y-axis baseline to the top

Demonstration 1: Descending
Bars
3. Add special effects (color gradient)

A look behind the scenes


Open graph object > Property Inspector
1.
2.

Edit Settings
Add the following XML
<Y1Axis ascending="false"/>

3.

Shift the Y-axis baseline to


the top

Add the following XML


<SeriesItems>
<Series id="0" borderColor=">
<SFX fillType="FT_GRADIENT" gradientNumStops="3">
<GradientStopStyle stopIndex="0" gradientStopColor="/>
<GradientStopStyle stopIndex="1" gradientStopColor="/>
<GradientStopStyle stopIndex="2" gradientStopColor="/>
</SFX>
</Series>

A look behind the scenes


Open graph object > Property Inspector
1.
2.

Edit Settings
Add the following XML
<Y1Axis ascending="false"/>

3.
Add special
effects (color
gradient)

Add the following XML


<SeriesItems>
<Series id="0" borderColor=">
<SFX fillType="FT_GRADIENT" gradientNumStops="3">
<GradientStopStyle stopIndex="0" gradientStopColor="/>
<GradientStopStyle stopIndex="1" gradientStopColor="/>
<GradientStopStyle stopIndex="2" gradientStopColor="/>
</SFX>
</Series>

Demonstration 2: Stock
Graph Use Case
You need to show movement in stock prices,
i.e.,

Days high price


Days low price
Opening price
Closing price

You would like to distinguish between:

Stocks where closing price > opening price


Stocks where closing price < opening price

Demonstration 2: Stock
Graph
1. Create Stock Graph of subtype Open-Hi-Lo-Close Candle

Demonstration 2: Stock
Graph
2. Add special effects (color gradient)

Demonstration 2: Stock
Graph
3. Specify custom colors

A look behind the scenes


Open graph object > Property Inspector
1.
2.

Edit Settings
Add the following XML

Add special effects (color


gradient)

<Graph graphType="STOCK_OHLC_CANDLE"
seriesEffect="SE_AUTO_GRADIENT">

3.

Add the following XML


<StockMarker fallingColor=" risingColor="/>

A look behind the scenes


Open graph object > Property Inspector
1.
2.

Edit Settings
Add the following XML
<Graph graphType="STOCK_OHLC_CANDLE"
seriesEffect="SE_AUTO_GRADIENT">

3.

Add the following XML


<StockMarker fallingColor=" risingColor="/>
Specify custom colors

Adding Special Effects to


HTMLCSS Reports

Pseudo-classes and pseudoelements


Cascading Style Sheet 2: style is based on
elements or attributes in the document tree, e.g.,
Type selectors
em {color: blue}

Class selectors
.big {color: blue}

Descendant selectors
p em {color: blue}

Attribute selectors
img[src="small.gif"] {border:1px solid #000}

Pseudo-classes and pseudoelements


Problem: how to apply styles to objects that lie
outside the document tree?
Examples:

First letter / first line of an elements content


Unvisited / visited hyperlinks

Solution provided by CSS 2:

Pseudo-classes and pseudo-elements

Demonstration:
Without pseudo-classes
1. Unvisited Link
2. Link on mouse hover

3. Active Link
(right-click or left-click)

4. Visited Link

Demonstration:
With pseudo-classes
1. Unvisited Link
2. Link on mouse hover

3. Active Link
(right-click or left-click)

4. Visited Link

A look behind the scenes


Pseudo-classes used
/* 1. unvisited link */
a:link
{color: blue}
/* 2. link on mouse hover
*/
a:hover
{color: red; font-size: 125%; font-weight:
bold}
/* 3. active link
*/
a:active {color: green}
/* 4. visited link
*/
a:visited {color: gray}

Demonstration Summary
Use pseudo-classes and pseudo-elements to apply
style to dynamic content
More information:
http://www.w3.org/TR/REC-CSS2/selector.html

Handling Error Conditions in


Java Server Page (JSP) Reports

Error Conditions
Error Examples

500 Internal Server Error


404 Not Found

Errors are inevitable in all applications


Best approach is to handle them gracefully

Users should not feel they have been thrown outside


the application look-and-feel
Users should be shown helpful hints for diagnosing
the problem / reporting the problem

Handling Error Conditions


Gracefully
Anticipate error scenarios
Create error pages that:

Share the look-and-feel with the application


Show helpful hints for each error / error type

Make provision for redirecting users to these error


pages:

Approach 1: Declare an error page in the JSP


Same page is shown irrespective of the error type
Approach 2: Define error pages in web.xml
Can define a different error page per error type

Handling Error Conditions


Gracefully
Anticipate error scenarios
Create error pages that:

Share the look-and-feel with the application


Show helpful hints for each error / error type

Make provision for redirecting users to these error


pages:

Approach 1: Declare an error page in the JSP


Same page is shown irrespective of the error type
Approach 2: Define error pages in web.xml
Can define a different error page per error type

Demonstration
Add a JSP-based Web report to an existing Web
application
Create a WAR
Deploy the WAR on OracleAS
Run the report

Demonstration: Simulated
Error Condition 1
Specify a non-existent database connect string
Result:

Handling Error Condition 1


Gracefully
Change web.xml

When this
</mime-mapping>
exception type is
<error-page>
encountered
<exception-type>
javax.servlet.jsp.JspException
</exception-type>
<location>myExceptionPage.jsp</location>
show this
</error-page>
page.
</web-app>

Re-package and re-deploy the WAR

Handling Error Condition 1


Gracefully
Result:

Demonstration: Simulated
Error Condition 2
Specify a non-existent page
Result:

Handling Error Condition 2


Gracefully
Change web.xml

When this HTTP


status code is
</mime-mapping>
encountered
<error-page>
<error-code>404</error-code>
<location>fileNotFound.jsp</location>
show this
</error-page>
page.
</web-app>

Re-package and re-deploy the WAR

Handling Error Condition 2


Gracefully
Result:

Summary
Errors are inevitable
Think about handling errors from users point of
view
Use web.xml to redirect users to meaningful error
pages

Q&
A

QUESTIONS
ANSWERS