developing e commerce-apps_oracle_and_java

30
Developing e-Commerce Applications Using Oracle and Java Megh Thakkar Director of Database Technologies Quest Software

Upload: pankaj-jagadale

Post on 25-Jun-2015

168 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Developing e commerce-apps_oracle_and_java

Developing e-Commerce Applications Using Oracle and Java

Megh ThakkarDirector of Database Technologies

Quest Software

Page 2: Developing e commerce-apps_oracle_and_java

Industry Directions

Brick and Mortar

Web Based Companies

E-Commerce

Page 3: Developing e commerce-apps_oracle_and_java

e-Commerce Challenges

High Availability (24*7*365/366)

Performance

Scalability

Security / Hackers

Page 4: Developing e commerce-apps_oracle_and_java

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

Page 5: Developing e commerce-apps_oracle_and_java

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

Page 6: Developing e commerce-apps_oracle_and_java

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

Page 7: Developing e commerce-apps_oracle_and_java

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

Page 8: Developing e commerce-apps_oracle_and_java

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

Page 9: Developing e commerce-apps_oracle_and_java

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

Page 10: Developing e commerce-apps_oracle_and_java

Use MTS Configure Large pool

Configuration Tips

Page 11: Developing e commerce-apps_oracle_and_java

Lsnrctl services netstat sess_sh

Checking IIOP Connectivity

Page 12: Developing e commerce-apps_oracle_and_java

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

Page 13: Developing e commerce-apps_oracle_and_java

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

Page 14: Developing e commerce-apps_oracle_and_java

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

Page 15: Developing e commerce-apps_oracle_and_java

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

Page 16: Developing e commerce-apps_oracle_and_java

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

Page 17: Developing e commerce-apps_oracle_and_java

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

Page 18: Developing e commerce-apps_oracle_and_java

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

Page 19: Developing e commerce-apps_oracle_and_java

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

Page 20: Developing e commerce-apps_oracle_and_java

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

Page 21: Developing e commerce-apps_oracle_and_java

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

Improving Speed of Execution

Page 22: Developing e commerce-apps_oracle_and_java

Multi-Threaded Server

Connection manager

Connection pooling

Orastack (Windows NT only)

Oracle9i Solutions for Increasing the Concurrent Connections

Page 23: Developing e commerce-apps_oracle_and_java

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

Page 24: Developing e commerce-apps_oracle_and_java

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

Page 25: Developing e commerce-apps_oracle_and_java

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

Page 26: Developing e commerce-apps_oracle_and_java

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

Page 27: Developing e commerce-apps_oracle_and_java

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

Page 28: Developing e commerce-apps_oracle_and_java

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

Page 29: Developing e commerce-apps_oracle_and_java

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

Page 30: Developing e commerce-apps_oracle_and_java

THANK YOU FOR LISTENINGBUY QUEST PRODUCTS