Developer's Guide to Oracle Web Application Server 3 (with CD-ROM), 1st edition
Authors: Dennis Harvey, Steve Beitler
Venue:  (1998)

From the Book:PREFACE: With business and technology moving at Internet speed, a book that can cut to the chase without cutting corners is a real find. In that spirit we'll get right to the point. If you're an application developer or someone who supervises or relies on people who write software, the book you're holding offers an extremely efficient way to get up to speedand beyondin one of the most dynamic segments of the software world. That's a strong claim, but we think we can back it up. We wrote this book as a practical, no-fluff guide to the architecture, concepts, design approaches, and challenges involved in using Oracle Web Application Server (OAS) 3.0 to develop business applications for the Web. Our focus is on Web applications that interact with relational databases, for several reasons that boil down to this: Those applications offer the biggest payoff in the shortest time to all kinds of organizations. What sets our book apart from the hundreds of books about the Web, Oracle products, and application development? First, we've included tons of code that we've used and that you can leverage to develop real applications. We use real-world, real-code examples. We also put key pieces of that code "under the microscope" to show you time- and trouble-saving techniques. In addition, we've written one large and several small applicationscomplete appsin all the major languages: PL/SQL, Java, Perl, C, and LiveHTML. We've found that writing the same application in several languages is a great way to learn how to use the strengths of each language. So no matter what your background, we show you how to develop powerful applications fortheWebfast! We also discuss the OAS 3.0 toolkits for PL/SQL and Java in great detail. This material will give you what you need to develop a wide range of applications with maximum efficiency. Finally, we've developed a Web application framework (WAF) for each of the cartridgesthey're the real building blocksof OAS 3.0. These WAFs augment the toolkit and are a gold mine when it comes to writing code that you can use over and over. When they're used properly, WAFs by themselves can save developers a month of work. In short, our book can help you bridge the chasm between the client/server world and the world of the Web. That's a bridge that many developers are being asked to crossfast! Okay. That's the overview from 50,000 feet and at warp speed. Let's pull back on the throttle just a bit. The Web Today One reason for the explosive growth of the Web is that it offers new ways to extend an organization's reach "beyond the walls" to customers, prospects, and partners over both intranets and the Internet. That's the good news. The not-so-good news is that understanding the technology, evaluating and selecting commercial tools and products, and planning, designing, and developing applications are about as easy as finding gold in your backyard. Our book is designed to help you find that gold no matter where your yard is. We said earlier that we had several reasons for focusing on Web applications that interact dynamically with relational databases. Let's look a little more closely at those reasons. For businesses, two-way interaction with database systems is the key to reaching beyond the walls of an organization in compelling new ways. Applications that provide access to the vast store of information in databases can transform the flow of information not only within organizations but also between organizations and their customers, employees, partners, and prospects. In addition, interaction with databases is the foundation of interactive and more personalized Web sites that go beyond the static sites that populate much of the Web today. But the most important reason for focusing on Web-database technology is that it addresses a lot of the issues that information technology (IT) people and end users have been wrestling with as client/server computing has become the dominant paradigm over the past ten years. Now please don't misunderstand. We think that client/server computing is a major step forward in putting information technology to work for all kinds of organizations. PCs, graphical user interfaces, and local and wide area networks have become pervasive elements of organizations' and people's work lives, and that's real progress. But this progress has been diluted by the challenges that client/server computing presents. For one thing clients have become "fat," that is, packed with software and hardware. In addition, administering these fat clients has become more difficult, as IT people have had to manage multiple versions of software on hundreds of clients spread across numerous organizations and geographies. Finally, there are limits to how this client software can be reused to extend applications across an enterprise. At the same time rapid advances in Internet and Web technology are encouraging IT people to embrace the Internet/Web model: "thin" clients, a middle tier that contains the application logic, and a database layer that includes the data and business rules. This model not only addresses the challenges posed by client/server computing but also provides additional benefits, including: Faster development of cross-platform, portable apps; Automated distribution of client applications from the application or database server; Elimination of most client runtime software and database network software from the client PC; Lower desktop software licensing costs; and Elimination of the need for complex synchronization of distributed databases in some vertical applications. These benefits are increasingly attainable as individuals and organizations have become more comfortable with Web browsers, such as Netscape Navigator and Microsoft Internet Explorer, as thin-client desktop software for many business applications, including database applications. In addition, many organizations are eager to use the Web and the Internet as their wide area networking infrastructures rather than build their own. The convergence of these forces, as well as the powerful appeal of the benefits they make possible, are making the late 1990s a time of extraordinary opportunity and challenge for software developers. Our book is designed to help you meet this challenge. Who Is This Book For? We think that three groups of people can benefit from our book. First, if you're an application developer or an analyst in an Oracle shop, our book will help you leverage and extend your client/server skills to the Web environment. One way we do this is by helping you evaluate some of the most important development tools for the Web. If you're developing Web-database applications in a non-Oracle environmentmaybe you're a Perl/CGI (Common Gateway Interface) programmer, for instancethis book can help you get up to speed quickly on the Oracle world. Finally, if you are managing people in an IT or software engineering group and your team is responsible for selecting computing architectures and developing Web applications, you've come to the right place. Why Oracle Web Application Server 3.0? We mentioned the first part of the answer earliernamely, that applications that interact with databases offer some of the greatest potential business benefits. Beyond that we believe that Oracle's Web Application Server 3.0 is a key product in the evolution of the Web. OAS is more than a development platform: It's an open, standards-based object architecture that helps to bring together the best of client/server computing with the power of the Web. OAS does this in several ways: It bridges several object architectures, unifies diverse Web server APIs (application program interfaces), and successfully integrates such key standards as Java, CORBA (Common Object Request Broker Architecture), and X/Open. A key component of Web Application Server 3.0 that we focus on in the book is cartridges, which store and execute the application logic and provide extensible functionality across the network. Cartridges can be programmed in Java, C, SQL, and other languages. Web Server 3.0 includes PL/SQL, Java, Perl, and LiveHTML cartridges; and the applications this book will help you write run "on top" of these cartridges. Cartridges are how Web Application Server 3.0 makes it possible for you to write applications that can be distributed and that can communicate across the network. Web Server 3.0 is a key component of Oracle's Network Computing Architecture (NCA), and we discuss NCA as background for understanding Web Server. NCA is Oracle's direction for designing, deploying, and managing distributed, mission-critical enterprise systems. NCA's goal is to combine the strengths of the client/server, Web/Internet, and object worlds. NCA is a cross-platform infrastructure for developing and deploying object-based, network-centric applications across the infrastructure that the Internet, Web, and intranets provide. At the heart of NCA are key standards and protocols, such as CORBA 2.0 and HTTP/HTML. NCA is significant for developers in part because it moves beyond the mainframe and client/server models in one key aspect: NCA decouples the application from the delivery mechanism. This means that applications developed within NCA are much more modular, extensible, transportable, and reusable than are apps developed in the client/server paradigm. How Can This Book Help You Succeed? The technical information in our book is based on direct, current experience with Oracle Web Application Server 3.0. We had virtually total access to early versions of this product, as well as to the engineering team that worked on it. (We live very close to Oracle headquarters, which was a big advantage during those dicey times, now long past, when not everything in the product worked perfectly the first time we tried it.) We also have extensive experience with Oracle Web Server 2.1, the predecessor to 3.0 that is widely used in many organizations. We've used 2.1 to develop IT and electronic commerce applications for organizations of many different kinds and sizes. We've also put in plenty of time in software engineering and IT management in client/server shops, so we know that world, too. Bottom line: The focus of our book is overwhelmingly on Web Application Server 3.0. But when it's useful to do so, we also call out the most important differences between 2.1 and 3.0 in order to shorten the time it will take you to put 3.0 to work for you. Our experience has shaped both the content and the structure of this book. For content we've focused on practical application-development problems and how to solve them within the Oracle environment. We've included lots of programming code that will help you solve real problems and develop applications using Oracle's development tools. The code and the sample applications cover what we feel are the three most critical application categories: business to business, business to customer, and intranet. In short, this book distills a lot of experience into a no-nonsense guide to the power and the potential "gotchas" of Oracle's Web-development solution. A Few of Our Assumptions As all authors must, we've made some assumptions about you and your background. We assume that you've had several years of experience developing client/server applications in an Oracle or other RDBMS (relational database management system) environment, such as Informix or Sybase. In other words, we assume that you have hands-on experience with basic Oracle technologies, such as the Oracle7 server and PL/SQL. We're also assuming that you have at least a working knowledge of HTML and that you are able to read Java code. Therefore we won't provide an introduction to Java programming. No book could cover every aspect of Web-database development, and ours is no exception. We decided early on that we wouldn't focus on thorough coverage of distributed object technology, for example. Many fine books on this topic already exist. Organization of the Book The first two chapters provide background information. Chapter 1 gives an overview of the recent evolution from two-tiered client/server applications to three-tiered client/server applications, leading to the recent emphasis on three-tiered (or n-tiered), thin-client Web applications. This chapter also describes how Web Application Server 3.0 fits into Oracle's Network Computing Architecture (NCA). Chapter 2 presents a highly condensed series of tutorials on the building blocks for HTML/HTTP Web applications: HTML, HTTP, and CGI. The intent is that these condensed tutorials will provide enough background information for non-Web programmers to benefit fully from our book. It is our sincere goal not to leave anyone behind. Chapter 2 concludes with summaries (not tutorials) of other relevant Web languages and technologies: Oracle PL/SQL, Java, Perl, JavaScript, and distributed object and CORBA. If you're already well versed in the background topics covered in the first two chapters, feel free to jump directly to Chapter 3, where we start to address the architecture and services of Oracle Web Application Server 3.0 in earnest. In Chapter 4 we provide some information on installation and getting started with OAS, and we cover basic system administration in considerable depth. In the rest of the book we develop applications for OAS using the broad range of OAS development tools: PL/SQL, Java, LiveHTML, ODBC, and Perl cartridges and in C/C11, using the Web Request Broker API. We also provide detailed information and sample applications demonstrating how to use the major application services of the OAS environment, including ICX, transactions, authentication, and logging. In Chapters 5 and 6 we present HelpDesk, our largest sample application for PL/SQL. This application incorporates many of the fundamental design features that you'll need for corporate business applications. We also present our Web applications framework (WAF package) for the PL/SQL cartridge. The WAF package augments the routines in the Web Toolkit for PL/SQL. In Chapters 7 and 8 we turn our attention to Java, covering the fundamentals and beyond and developing Java applications. Chapter 9 reviews the other cartridges: LiveHTML, ODBC, and Perl. Chapters 10 and 11 focus on the WRB API. Chapter 12 looks at transactions in detail. In Chapter 13 we summarize the importance of OAS as an application server technology and make some predictions about its future. The appendixes provide complete source code for the applications developed in the text. Now we're ready to dive in. We can't imagine a more exciting time to be developing business applications, and our goal is to help you to turn that potential into reality in ways that will both be a real contribution and provide professional and personal fulfillment to you. We want to help you to cut through the clutter and focus on the key concepts, information, and techniques that you'll need. In other words, our book is designed to advance your quest for the "gold" that powerful Web applications represent as we start the twenty-first century. Acknowledgments It was a pleasure to work with the staff at Addison-Wesley to create this book. In particular, we'd like to thank Mary O'Brien, Acquisitions Editor, for her initial support and steadfast encouragement throughout this project. Elizabeth Spainhour helped with many of the logistics of putting together this book, including coordinating the technical reviews and numerous other tasks. We'd also like to thank Genevieve Rajewski and John Fuller for all their efforts to produce this book. The following people reviewed the manuscript and provided many valuable suggestions: Joseph Duer, Jerry Latimer, Gregg McCroskey, Ashesh Parekh, Sam Pillay, Uday Shankar, Harvey Tokunaga, and John Wegis. Numerous people at Oracle Corporation provided critical help by including us in the managed beta program for Web Application Server 3.0 for Windows NT, by providing access to early and late beta copies of 3.0, and by helping us with myriad technical details required to produce an accurate and comprehensive book. These people include Mike Bean, Jack Cai, Craig DeNoce, Mike Freedman, Elizabeth Kao, Rohit Kumar, Magnus Lonnroth, Gregg McCroskey, and Rajeev Singh. We'd especially like to thank Gregg McCroskey for providing frequent updates to the OAS 3.0 software and for coordinating access to technical information. Mike Freedman and Mike Bean made time for us in a busy engineering schedule to help put OAS 3.0 in perspective.