developing e commerce-apps_oracle_and_java

Post on 25-Jun-2015

168 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Developing e-Commerce Applications Using Oracle and Java

Megh ThakkarDirector of Database Technologies

Quest Software

Industry Directions

Brick and Mortar

Web Based Companies

E-Commerce

e-Commerce Challenges

High Availability (24*7*365/366)

Performance

Scalability

Security / Hackers

Reality CheckCompany Outage Cost Results

eBay

AT&T

Charles Schwab

Bank of Singapore

Tabcorp Australia

E*Trade

AOL

June 12, 199922 hours

April 13, 199826 hours

Feb 24-Apr 21, 994 hours

July 1-8, 1999

October 1999

March 3-4, 1999

April 6, 199624 hours

$3-5 Million

$40 Millionin rebates

undetermined

undetermined

$10 Millionin rebates

undetermined

$3 Millionin rebates

26% stock price drop

Changedinfrastructure

Loss of integrityand interestKey betting days lost

22% stock price drop

Upgrade infrastructure$80 MillionUpgrade infrastructure$70 Million

Important Java Features Object-oriented language It allows the development of applications using an

open standard It enables the development of portable applications It allows the reuse of code by means of JavaBeans

and Enterprise JavaBeans (EJB) resulting in improved productivity

It can execute in browsers, application servers, and databases

It allows applications to be deployed in two-tier and multi-tier configurations

When to use Java? CPU-intensive “number crunching”

operations To overcome PL/SQL limitations

- Host command- Limitations with UTL_SMTP

Extend the client types When object-oriented features are more

suitable

REMEMBER THAT JAVA IS CASE-SENSITIVE

Standard PL/SQL package

Equivalent Java implementation

DBMS_ALERT No pure Java equivalent. DBMS_DDL JDBC has an equivalent mechanism for this. DBMS_JOB No pure Java equivalent. DBMS_LOCK No pure Java equivalent. DBMS_MAIL JavaMail DBMS_OUTPUT DBMS_JAVA.SET_STREAMS can be used to

redirect System.out to DBMS_OUTPUT. The standard Java OutputStream api can be used with the subclass oracle.aurora.rdbms.OracleDBMSOutputStream

DBMS_SESSION JDBC can be used to execute ALTER SESSION DBMS_SQL JDBC can be used. DBMS_UTILITY No pure Java equivalent UTL_FILE Classes File, FileOutputStream and

FileInputStream. Use of these classes requires the granting of JAVAUSERPRIV privilege.

PL/SQL Packages and Their Java Equivalents

Two related Java execution environments are provided in Oracle9i:

Oracle JServer VM that is integrated with Oracle9i allowing data

intensive Java logic to run and Java VM integrated with Oracle Application Server (iAS) as a Java cartridge

Java Server Platforms

Select count(*) from dba_objects where object_type like ‘JAVA%’;

Select dbms_java.longname(name) from sys.obj$ wheretype# = 29 and status != 1;

Ensuring JVM Setup

Use MTS Configure Large pool

Configuration Tips

Lsnrctl services netstat sess_sh

Checking IIOP Connectivity

Database programmers can write traditional stored procedures, triggers and object-relational methods in Java Component-based Java developers can write reusable server code in the form of Enterprise Java Beans Distributed system developers can develop CORBA servers in Java Web developers can use Java Server Pages to embed Java tags in HTML pages to dynamically generate HTML pages directly from Oracle9i

Support for Different Types of Application Developers

Oracle9i provides two different client-side programmatic interfaces for Java developers:

JDBC (Four types)

SQLJ (allowing SQL to be embedded in Java)

Client-side Programmatic Interface

Feature JDBC OCI driver JDBC thin driver

Support for applets No Yes

Support for SQL*Net All SQL*Netadapters aresupported includingIPC, Named Pipesand TCP/IP

Only TCP/IP issupported

Encryption Yes. By using theAdvanced NetworkOption of Net8

Not supported

Driver type Type 2 driver. JDBCinterfaces areimplemented thatuse OCI to interactwith the Oracledatabase

Type 4 driver.Makes use of Javasockets to connectdirectly to anOracle database

Choosing the Appropriate JDBC Driver

Characteristics Enterprisedeveloper suite:Designer,Developer,Developer Server

JdeveloperSuite (+ UML):Java IDE, BC4J,UML Modeling

WebDB (portals)

Interactiveuser interface

Best Good Good

Single point ofaccess tocorporateservices

Good Better Best

E-Commercesupport

Intranet-based Internet-based

Internet-based

Programmingmodel

PL/SQL-based;declarativemodel

Java-based;componentmodel

Java-based;componentmodel

Mature & proventechnology

Yes Partial No

Web enablinglegacy systems

Best Good Good

Choosing the Right Tool

Interaction of threads and automated storage management or garbage collection Achieving minimum incremental per-user session footprint Java executes platform-independent byte codes on top of a virtual machine. The virtual machine then deals with the specific hardware platform. This makes the execution slightly inefficient

Challenges in Developing a Scalable Java Environment

Garbage collection is a major aspect of the Java language’s automated storage management mechanism

Although Oracle9i supports Java language level threads, all Java code in Oracle9i executes as a call within a session Java programs can use the same scalability architecture used by Oracle internally The garbage collector used in Oracle9i Java virtual machine never collects garbage from more than one user at any time Each user experiences as if she is executing her own Java code in her own virtual machine

Garbage Collection Issues

Size of the programThis is determined by the number of classes and

methods and the amount of code they contain. Program complexity Amount of core class libraries used as the program executes State objects used This depends upon the number of objects allocated, their size and how many are retained across calls Ability of the garbage collector and memory manager to cope with the demands of the program

Factors Affecting Footprint

Footprint can be reduced by sharing resources across Java processes Release large data structures at end-of-call Data structures that are candidates for end-of-call optimization include:

- Buffers or caches- Static fields- Dynamically built data structures

Reducing Footprint

The following parameters affect memory usage and performance of Java code:

- shared_pool_size- java_pool_size- java_soft_sessionspace_limit (default 1MB)- java_max_sessionspace_size (ORA-29554) (default 4GB)

SELECT * FROM v$sgastat WHERE pool = ‘java pool’;

Initialization Parameters

Use natively compiled code such as core Java class libraries and Oracle-provided Java code

Improving Speed of Execution

Multi-Threaded Server

Connection manager

Connection pooling

Orastack (Windows NT only)

Oracle9i Solutions for Increasing the Concurrent Connections

Allows many user threads to share very few server threads User threads connect to a dispatcher process which routes client requests to the next available server thread

Result: More users are supported

Multi-threaded Server

Concentrates multiple clients into a single multiplexed data connection

Clients can use different protocols

Result: Applications can be used continuously by the clients

Connection Manager

Places idle users in a suspended mode and reassigns their physical connections until they become active again

Result: Ideal for users that need to be logged on all the time but don’t need to really use the application

Connection Pooling

Can be used to change the default reserved stack space used by each Oracle thread

Result: Allows more user connections

USE WITH EXTREME CAUTION

Orastack

Part of the iAS product Must first install DBMS_PACKAGE in the SYS schema Generates JAVA wrapper classes for PL/SQL procedures and functions in PL/SQL packages The wrapper classes can be called from the JAVA programs to invoke the PL/SQL program units

Syntax:pl2java username/password@connect-string plsql_package

Using PL/SQL in JAVA – PL2Java

HTML pages with JAVA as the embedded language Different from mod_plsql (or PL/SQL cartridge) JSPs cache compiled code Creation, compilation and execution of servlets is handled by the JSP engine

Java Server Pages

Oracle 8.1.5 allows security through roles Oracle 8.1.6 and above allows roles as well as Java 2 security initjvm.sql creates 2 roles:

JAVAUSERPRIVS (open a TCP/IP socket; read/write file using UTL_FILE_DIR)JAVASYSPRIVS (all privs from JAVAUSERPRIVS + create subprocess, set socket factory, set stream handler, listen on specific ports)

Use DBMS_JAVA package Views: DBA_JAVA_POLICY and USER_JAVA_POLICY

Java Security

THANK YOU FOR LISTENINGBUY QUEST PRODUCTS

top related