Connection Cache Sample Application - Readme Connection Cache Sample Application - Readme


Date: 04-Feb-2004


Table of Contents

Introduction
Application Overview
Setting up and Running the Application
Sample Application Files
Additional References

Introduction

Prerequisite

The user is expected to have technical knowledge in the following area,
  • JDBC

Technical Overview

This sample illustrates the usage of Connection caching features in Oracle Database 10g JDBC drivers. This sample uses the JDBC thin driver; the code remains the same for JDBC OCI, except for the database URL syntax.

Connection caching, generally implemented in a middle tier, is a means of keeping and using caches of physical database connections. Oracle's implementation of Connection Caching uses the Connection Pooling Framework in much of its operations.

Each connection cache is represented by an instance of a connection cache class and has an associated group of pooled connection instances. For a single connection cache instance, the associated pooled connection instances must all represent physical connections to the same database and schema.

Pooled connection instances are created as needed, which is whenever a connection is requested and the connection cache does not have any free pooled connection instances.

The connection caching architecture has been redesigned so that caching is transparently integrated into the datasource architecture. It uses the implicit connection caching mechanism, which is more powerful and easier to use.

With the addition of new class, OracleConnectionCacheManager, applications can use its rich set of administrative APIs to manage the connection cache. This class replaces the deprecated OracleConnectionCacheImpl. Applications can manage their cache either through the single OracleConnectionCacheManager instance or through the OracleDataSource associated with the cache. The benefits of using OracleConnectionCacheManager over OracleConnectionCacheImpl are,
  • Transparent access to the connection cache
  • Compliance to JDBC 3.0 standards
  • Supports connection recycling and refresh of stale connections
  • Supports attribute based search for conceits
  • Supports multiple cache enabled DataSource
  • Supports connection cache call back mechanism

Application Overview

Consider that a fictitious organization has internet enabled all its applications. Sales and marketing employees of this organization use web-based Order Entry application to monitor various Orders and order status for various products .

This simplified Order Entry application connects to the database and fetches the product catalog and all the products are shown to the user. User can choose a particular product and view orders for the product. Also the application is provided with a user interface to manage the connection cache proprties and behaviour.

Assuming that the organization is huge, it is likely that lot of sales employees use the Order Entry Application at the same time. As this Order Entry application fetches the data from the database, the cost of using a dedicated physical database connection per user is quite high. To reduce this overhead, this application makes use of Connection Cache. This Sample shows how to set up a implicit Connection Cache, get a Connection from the cache and return the connection to the cache and re initialize the connection properties using the OracleConnectionCacheManager.

In this sample, the connections are closed only when the active size reaches the maximum cache limit. This ensures that atleast one connection is available in the cache, after it reaches the maximum limit. Also this demonstrates the growth of the cache till the maximum set limit. 

Setting up and Running the Application

For setting up and running the application, download the ConnCacheSample.jar and refer to the installation document.

Sample Application Files 

This section will provide a tabular listing of the sample application files, along with their respective directory locations and a description of what they do in the overall scheme of the application.

Directory File Description
Readme.html

This file

Install.html

Sample installation document

EnvSetup.html
Environment variable set up readme file
Java source files
Java source files used in the sample application
JSP files
Used as the web interface
Connection.properties
This file has the details of the database connection parameters
application.xml
This file is used to define the J2EE EAR file, which contains the location of EJB JAR file, Web application WAR file and is included in the EAR file
web.xml
This file is used to define the Web deployment descriptors and is included in the WAR file
orion-web.xml
This file is used to define the container specific deployment descriptors and is included in the WAR file. This configures the web application classloader to override its default behaviour and direct it to load local classes in preference to classes from a higher level.
build.xml
Ant build file used to build and deploy to the application
ConnCacheSample.jws
JDeveloper project workspace file
ConnCacheSample.jpr
JDeveloper project file

Additional References 


Please enter your comments about this sample application here.

 

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy