Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

professional oracle 8i application programming with java, pl sql and xml
PREMIUM
Số trang
1144
Kích thước
13.0 MB
Định dạng
PDF
Lượt xem
1611

professional oracle 8i application programming with java, pl sql and xml

Nội dung xem thử

Mô tả chi tiết

www.it-ebooks.info

Professional Oracle 8i

Application Programming

Michael Awai

Matthew Bortniker

John Carnell

Sean Dillon

Drew Erwin

Jaeda Goodman

Bjarki Hólm

Ann Horton

Frank Hubeny

Thomas Kyte

Glenn E. Mitchell II

Kevin Mukhar

Gary Nicol

Daniel O'Connor

Guy Ruth-Hammond

Mario Zucca

Wrox Press Ltd. 

www.it-ebooks.info

Professional Oracle 8i

Application Programming

© 2000 Wrox Press

All rights reserved. No part of this book may be reproduced, stored in a retrieval system or

transmitted in any form or by any means, without the prior written permission of the publisher,

except in the case of brief quotations embodied in critical articles or reviews.

The author and publisher have made every effort in the preparation of this book to ensure the accuracy

of the information. However, the information contained in this book is sold without warranty, either

express or implied. Neither the authors, Wrox Press nor its dealers or distributors will be held liable for

any damages caused or alleged to be caused either directly or indirectly by this book.

Published by Wrox Press Ltd,

Arden House, 1102 Warwick Road, Acocks Green,

Birmingham, B27 6BH, UK

Printed in Canada

ISBN 1-861004-84-2

www.it-ebooks.info

Trademark Acknowledgements

Wrox has endeavored to provide trademark information about all the companies and products

mentioned in this book by the appropriate use of capitals. However, Wrox cannot guarantee the

accuracy of this information.

Credits

Authors Technical Reviewers Author Agents

Michael Awai Duncan Ainsworth Tony Berry

Matthew Bortniker Danny Ayers Velimir Ilic

John Carnell Yogesh Bhandarkar

The Churchill Team Graham Bowden Project Administrators

Sean Dillon Luis Cabral Cilmara Lion

Drew Erwin Robert Chang Chandima Nethisinghe

Jaeda Goodman Jitendra Chitkara

Bjarki Hólm Daryl Collins Indexers

Ann Horton Michael Corning Alessandro Ansa

Frank Hubeny Jeremy Crosbie Andrew Criddle

Thomas Kyte Dean Dameron

Glenn E. Mitchell II Robin Dewson Production Coordinator

Kevin Mukhar Sean Dillon Tom Bartlett

Gary Nicol Drew Erwin

Daniel O'Connor Mark Fehrenbacher Illustrations

Guy Ruth-Hammond Dario Ferreira Gomes Shabnam Hussain

Mario Zucca Nikolay Fiykov

Frank Hubeny Cover

Contributing Authors Manzoor Hussain Shelley Frazier

Sandeepan Banerjee Mike Kay

Frank Bell Aakash Kambuj Proof Readers

Bambi Bellows Doug Kanwischer Chris Smith

Kelly Cox Victor Kolesov Keith Westmoreland

Shekhar Dhupelia Thomas Kyte Agnes Wiggers

Michael Kay Todd Lauinger

Karen Little Production Manager

Technical Architect Steven Livingston Simon Hardware

Tony Davis Jim MacIntosh

Jennifer McGurk

Technical Editors Vinay Menon

Fiver Löcker Jon Millard

Jim Molony Brian Peasland

Mohammed Rfaquat Sarma PRKV

Robert Shaw John Roberts

Jordon Saardchit

Managing Editor Anunaya Shriwastava

Paul Cooper Leslie Tierstein

Raj Vuchatu

Hiroko Wilensky

www.it-ebooks.info

About the Authors

Michael Awai

Michael Awai lives near Charlotte, North Carolina, USA. He is currently a Consulting Partner with a

successful privately owned consulting company. He works as a system architect, helping clients leverage

the Internet, build extranet services and accomplish their application and business integration goals. He

and his partner Karla are currently expecting their first baby and their first Irish wolfhound.

Matthew Bortniker

Matt has been in the computer field since 1982 and is an independent consultant for local businesses

in the Washington DC area and for the US government. Currently his main tasks include upgrading

client server applications to enterprise wide systems written entirely in Visual Basic and utilizing

Oracle and Microsoft technologies. He is the author of Professional VB6 MTS Programming, ISBN

1861002440,and contributing author in Professional Windows DNA, ISBN 1861994451, (both Wrox

Press). He can be reached at [email protected].

John Carnell

John Carnell has had an obsession with computers since he was twelve years old, working on his

Commodore 64. That obsession never waned and he is currently working as a Senior Systems

Architect for Workscape, a leading provider of Human Resources and and Employee Benefits self￾service solutions. John's favorite topic of discussion, much to his wife's chagrin, is component based

N-tier architectures. John has extensive experience with Microsoft, Oracle and Java N-tier solutions.

He lives in Waukesha, Wisconsin with his wife Janet and his two pups Ladybug and Ginger. John can

be reached at [email protected].

For my mother Deborah: What I have achieved in my life is a summation of your hard work, dedication, and

most importantly your sacrifices.

And to Janet: You are my inspiration. I love you both.

The Churchill Team

Chandrabhanu Ambatipudi, Ekta Rani Agarwal, John Ipe, and Makarand Kulkarni form the ‘Oracle

supreme & Java dream’ team at Churchill Software Services India (CSSI). CSSI was established in

1996 in Bangalore India as an Oracle offshore development center, by an ex-Oracle UK management

team. Since its inception the center has been serving the UK market with an exclusive focus on the

Oracle platform, meshing cutting edge technologies with established Oracle technologies, and

providing innovative road map solutions for the Internet age.

Sean Dillon

Sean got his start programming a Commodore Vic 20, back in 1980. Trying to program sprites and

word games in the enormous 3.5Kb of user memory was truly a labor of love. He is now a Senior

Oracle Technologist, working for Oracle Corporation based in Reston, Virginia. He has eight years

of experience specializing in database architecture, tuning, web application development, and now

XML-based technologies. Sean is one of the lead designers on Oracle's Web Education Initiative for

children, Think.com. He is also an avid Quake player. Sean lives outside Washington, DC with his

wife, Whitney, and two sons, Jordan and Cameron.

I would like to thank my wife for her never-ending support and encouragement.

www.it-ebooks.info

Drew Erwin

Drew is a technical project leader and has been working with Oracle products for the last nine years.

The last three of those have been dedicated to enterprise application development with the ever

changing and improving Oracle toolset. Outside of work, Drew’s interests include his family, Pam

and Hannah, his Playstation, and traveling.

Jaeda Goodman

Jaeda Goodman is currently working as a Principal Software Engineer for Keane Ltd., the company

who were responsible for the Sun Connect Framework. She has over four years experience working

with Oracle and Java, encompassing everything from data warehousing to EJBs, servlets and JSPs –

and also InfoBus, if anyone needs any advice or consultation about this now esoteric technology.

Jaeda’s non-technical interests include house restoration, American TV imports, and the ability to

make an amazing blue punch, although of course the latter does not mix well with all of the former,

especially InfoBus.

I'd like to dedicate this to everyone who went through the Synchromatic experience with me.

Bjarki Hólm

For more than three years Bjarki has been designing and developing commercial software tools at

SALT Systems, Inc. His work includes the development of SALT Solutions, a website construction

suite built with Java technology. His areas of (technical) interest include Enterprise Java, XML and e￾commerce Oracle applications. In his working and waking hours, Bjarki is studying computer

engineering at the University of Iceland, and with his Wrox authoring on top of this, he tends to get

very little sleep. Bjarki can be reached at [email protected].

Ann Horton

Ann Horton is the President of Horton Associates, Inc. and has over twelve years experience designing,

developing, and managing Oracle projects. She has worked closely with Oracle Corporation for many

years, is active in the Oracle User Group Community, and is a frequent presenter at ODTUG, IOUG-A,

RMOUG, and ECO conferences. Ann has been extremely active in the Oracle Development Tools User

Group (ODTUG) serving as a member of the Board of Directors, conference chairperson, and paper

selection chair for numerous conferences, and ODTUG Volunteer of the Year for 2000. Ms. Horton has

also worked as an Affiliate Professor for the Regis University evening MSCIS Program since 1992 teaching

database classes to working students in the Denver area. In her spare time, Ann enjoys biking, hiking, bird

watching, and scuba diving with her husband Dean.

Thanks to my husband Dean, my brother Tom, Jim, and Betty, and all my friends who have encouraged me to

participate in this book project!

Frank Hubeny

Frank Hubeny is a certified Oracle 8i DBA and currently works for Experian doing data warehousing.

He has recently worked for WExcel in Chicago where he designed and built databases for web

applications and used the PL/SQL Toolkit extensively.

www.it-ebooks.info

Thomas Kyte

Thomas Kyte is an Oracle professional who works for Oracle Corporation in the US. He specializes

in database architecture, implementation, and tuning. In addition to his regular duties at Oracle, Tom

writes an ongoing article for Oracle Magazine and can be found on the web answering questions via

‘Ask Tom’ on the Oracle Magazine website. Prior to working for Oracle, Tom worked with a

contractor developing database applications and tools using many different commercial database

products. Tom lives in Leesburg VA, USA with his wife Lori and two children, Alan and Megan.

Glenn E. Mitchell II

Glenn E. Mitchell II, who prefers ‘Mitch’, wears many different hats. He is president of .Com

Consulting Group, a computer-consulting firm in Tallahassee, Florida. Mitch is also a faculty

administrator at the University of South Florida in Tampa, Florida, where he directs the State Data

Center on Aging, teaches graduate and undergraduate students, and earns lots of frequent flyer miles.

He also holds a Ph.D. from the University of Iowa. Mitch writes and speaks at conferences

extensively on object-oriented analysis and design, C++, Java, Visual Basic, and Microsoft SQL

Server. When not a busy professional, Mitch is husband to Lillian and dad to Jessica. Lillian is a

veterinarian, whose passion is small animal medicine. Jessica recently became a teen and spends her

spare time alternately studying Latin and listening to pop music.

Mitch wants to dedicate his contribution to his wife, Lillian, who is also a busy professional and tolerates him

spending countless hours in front of the computer.

Kevin Mukhar

Kevin Mukhar is a software engineer who lives and works in Colorado, USA. He spent 12 years in the US

Air Force, where many of his jobs included using computers, but none of them involved writing software.

Still, he managed to dabble in various languages as a hobby, and had enough practical experience to land

a software engineering job when he left the Air Force. For the past two years he has been part of a team

that developed a distributed system to manage and access large amounts of binary data from an Oracle

database. His heroes are Steve McConnell and Philip Greenspun. Now that he has finished writing (part

of) a book, he understands why many married writers thank their spouse; and so, he too, thanks his wife

for tolerating him during the last few months.

Gary Nicol

Gary Nicol is a Senior Consultant within the eBusiness division of Mi Services Group, and has

worked on a number of web-based projects involving integration of Oracle and Microsoft

technologies. Having originally cut his teeth on a Sinclair ZX Spectrum, he took a twisted career

path, via a degree in Electronic Engineering, followed by a brief incarnation as a semiconductor

engineer, before realising that developing software was a much more fun way to spend his working

day. In writing for this book, he has surprised not only himself, but probably a number of his high

school teachers, who would never have believed he was capable of forming a coherent sentence (even

when they could read his handwriting).

www.it-ebooks.info

Daniel O'Connor

Daniel O'Connor is an independent software developer currently working on management applications

using J2EE technologies, including EJB and JSP. He is a member of the board of directors for jBoss.org, an

open-source application server featuring an EJB container. He is one of the authors of the Professional Java

Server Programming J2EE Edition, Wrox Press, ISBN 186199463. He is also a principal of MVCSoft, Inc.,

which provides training and consulting on J2EE application development.

I would like to dedicate my efforts in this book to Christina Coughlin.

Mario Zucca

Some years ago Mario moved from the procedural world to the object-oriented one. Although it was

a difficult step to take he's since fallen in love with Java and J2EE technologies and in particular with

XML-related technologies such as XSL, XPath and SOAP.

I love freedom! I would like to dedicate this book to my daughter Federica. When she reads this book, many of the

technologies will be prehistoric things, but I hope in an even freer world.

www.it-ebooks.info

www.it-ebooks.info

Summary of Contents

Introduction 1

Section I: The Database 11

Chapter 1: Internet Programming with Oracle 8i 11

Chapter 2: Enterprise Application Design 31

Chapter 3: Database Foundations 53

Chapter 4: Scaling Your Application with Net8 83

Chapter 5: Enterprise Development with Designer 6i 105

Section II: PL/SQL and the Web 171

Chapter 6: PL/SQL Development 171

Chapter 7: PL/SQL Server Pages 207

Chapter 8: The PL/SQL Web Toolkit 225

Chapter 9: A Stock Tracker using the PL/SQL Web Toolkit and JavaScript 257

Chapter 10: Web PL/SQL Application Development Using Designer 6i 291

Section III: Java 343

Chapter 11: Oracle JVM and Java Stored Procedures 343

Chapter 12: Oracle Access with JDBC 393

Chapter 13: Connection Pooling and Caching 453

Chapter 14: Database Connectivity with SQLJ 501

Chapter 15: Enterprise JavaBeans and Oracle 557

Chapter 16: Inside the Database 629

Chapter 17: Business Components for Java 655

Chapter 18: A Discussion Forum using PL/SQL and Java 719

Chapter 19: Overview of Oracle interMedia Text 779

Chapter 20: Building a Search Engine using Java and interMedia 803

Section IV: XML 827

Chapter 21: Oracle and XML 827

Chapter 22: A Case Study in Enterprise Application Development 893

Chapter 23: Application Integration using SOAP 941

Chapter 24: Wireless Applications with Oracle Portal-to-Go 1005

Chapter 25: ASP, XML and Oracle 1049

Section V: Appendices 1107

Appendix A: Installation Issues 1107

Appendix B: Java Primer 1145

Appendix C: XML Primer 1179

Appendix D: Support, Errata, and p2p.wrox.com 1221

Index 1227

www.it-ebooks.info

Table of Contents

Introduction 1

What this Book is About 1

Who Should Use this Book 2

How this Book is Structured 2

The Database 3

PL/SQL and the Web 3

Java 4

XML 5

Appendices 6

The Tools you Need for this Book 6

Development Kits 6

Web and Application Servers 7

Tools 7

Conventions 7

Customer Support 8

Source Code and Updates 8

Errata 8

Section I: The Database 11

Chapter 1: Internet Programming with Oracle 8i 11

A Brief History of Oracle 12

Versions and Editions of Oracle 8i 13

Programming Support 14

PL/SQL 14

The PL/SQL Web Toolkit 15

PL/SQL Server Pages 16

Traditional Oracle Development Tools 16

Oracle Forms and Reports 16

Oracle Portal 17

Designer 17

www.it-ebooks.info

Table of Contents

ii

Oracle 8i and Java 18

The Oracle Java Virtual Machine 19

Advantages of the Oracle JVM 20

JDK Compatibility 20

Java Stored Procedures 20

Differences between Oracle JVM and JDK 20

The J2EE Framework and Oracle 21

Java Database Connectivity (JDBC) 21

SQLJ 21

Servlets and JavaServer Pages (JSP) 22

Enterprise JavaBeans 22

Remote Method Invocation (RMI) with CORBA and IIOP 23

JDeveloper 23

Business Components for Java (BC4J) 23

Oracle XML Developer's Kit 24

Oracle InterMedia 25

Text Services 25

Imaging, Audio, and Video Services 25

Oracle Spatial Cartridge 25

Oracle 8i and the Internet 26

Internet Application Server (iAS) 26

Oracle iAS Standard Edition 26

Oracle iAS Enterprise Edition 26

9iAS Wireless Edition 26

Oracle HTTP Server 26

Oracle JSP 27

Oracle 8i JVM 27

Portal-to-Go 27

Oracle iCache 27

Summary 28

Chapter 2: Enterprise Application Design 31

The EAD Concept 32

The Evolution to N-Tier Computing 33

Two-Tier Architecture 33

Scalability 34

Hidden Costs 34

Flexibility Issues 34

Three-Tier Architecture 35

Advantages of Three-Tier 36

Reuse of Code 36

Problems with Three-Tier 37

N-Tier Architecture 38

Scalability and Redundancy 40

Integration 41

Adaptability 41

Problems with N-Tier 42

www.it-ebooks.info

Table of Contents

iii

Oracle and EAD 43

PL/SQL Development 43

Java Development 44

Containers and the Middle Tier 45

Services 46

Transaction Management 46

Declarative Security 46

Error Handling 46

Business Logic 46

Scalability 47

Portability 47

When to Use Java 47

The Supporting Cast of Oracle Software 48

XML 48

Communication Issues 49

Summary 49

Chapter 3: Database Foundations 53

Database History 54

Logical Structures 56

Components of an Oracle 8i Database 56

Data Dictionary 56

Internal RDBMS Tables 57

Data Dictionary Tables 57

Data Dictionary Views 57

DBA Views 58

User Views 58

All Views 58

Dynamic Performance Views 58

Oracle Instance 58

Data Files and Tablespaces 59

Blocks 60

Segments 60

Table Segments 60

Index Segments 60

B*Tree Index 61

Reverse Key Indexes 62

Bitmapped Indexes 62

Function-Based Indexes 63

Cluster Segments 63

Table Clusters 63

Hash Clusters 64

Rollback Segments 64

Temporary Segments 64

Extents 64

www.it-ebooks.info

Table of Contents

iv

Oracle 8i Object/Relational Database 65

Object Types 65

Object Columns 66

Object Views 66

Object Table 66

Object Identifier 67

Collections 67

Nested Tables 67

Varrays 68

Oracle Memory Structures 68

System Global Area 68

Shared Pool 69

DB Buffer Cache 70

Redo Log Buffer 71

How Redo Logs Work 72

Program Global Area 73

Background Processes 74

System Monitor (SMON) 74

Process Monitor (PMON) 75

Database Writer (DBWn) 75

Redo Log Writer (LGWR) 75

Checkpoint (CKPT) 76

Optional Processes 76

Redo Log Archiver (ARCH) 76

Recoverer (RECO) 77

Starting an Instance 78

Oracle's Database Initialization File 78

Control Files 79

Recap 79

Summary 81

Chapter 4: Scaling Your Application with Net8 83

What Net8 Does 84

Why Use Net8? 84

Typical Scenarios 85

Two-Tier Client/Server 85

Multi-Tier Client/Server 89

Oracle Connectivity 90

Connecting to a Server 91

The Network Service Name 91

Network Route 91

Global Database Name 91

The Connection Process 91

Bequeathed Sessions to Dedicated Server Processes 92

Redirected Sessions to Existing Server Processes 93

Refused Sessions 95

Disconnecting from a Server 95

www.it-ebooks.info

Table of Contents

v

Data Operations 95

Migrating to Net8 96

Net8 Tuning 96

Net8 Troubleshooting 98

Diagnosing the Network 98

Diagnosing the Server 99

Diagnosing the Client 100

Some Common ORA Errors and What To Do 101

Summary 102

Chapter 5: Enterprise Development with Designer 6i 105

Designer 6i Software Architecture 106

The New Oracle Repository 108

Repository Objects 108

Containers 109

File Objects 110

Version Control 111

Configurations 112

Dependency Analysis 113

Workareas 113

Overview of Designer 6i Tools 114

Setting up the Oracle Repository 116

Enabling Version Control 117

Maintaining Users 117

Administering the Oracle Repository 120

Introducing the Repository Object Navigator (RON) 120

About Wastebaskets 122

Selecting a Repository Workarea 123

Create an Application System Container 123

The Case Study 125

Getting Started 126

Overview 126

Database Design and Development Process Using Designer 128

Develop a Conceptual Data Model of Requirements 128

Case Study Data Requirements 129

Oracle's Entity Relationship Diagramming Conventions 130

Develop the Education Center Entity-Relationship Model 131

Log on to Designer 132

Create an Entity-Relationship Diagram 133

Create the Entities 134

Create the Relationships 136

Add the Attributes 138

Create Domains 140

Assign a Domain to an Attribute 142

Define a Unique Identifier for each Entity 143

Print Entity and Attribute Reports 145

Review the ERD's Quality 146

www.it-ebooks.info

Tải ngay đi em, còn do dự, trời tối mất!