CodeNotes for Oracle 9i
By Gregory Brill (Editor)
3.5/5
()
About this ebook
a developer to ramp up on a new technology or language.
Unlike other programming books, CodeNotes drills down to
the core aspects of a technology, focusing on the key elements needed in order to implement it immediately. It is a unique resource for
developers, filling the gap between comprehensive manuals and
pocket references.
Through real-world examples of PL/SQL queries, stored procedures, triggers, indexing, and more, CodeNotes for Oracle 9i illustrates the complete Oracle database framework, PL/SQL, security, administration, and optimization. Oracle’s integration with Java and support for XML are extensively covered.
This edition of CodeNotes includes:
• A global overview of this technology and explanation of what
problems it can be used to solve
• Real-world examples
• “How and Why” and “Bugs and Caveats” sections that provide hints,
tricks, workarounds, and tips on what should be taken advantage
of or avoided
• “Design Notes” illustrating many of the common use patterns
for Java programs
• Instructions and classroom-style tutorials throughout from expert
trainers and software developers
Visit www.codenotes.com for updates, source code templates, access to
message boards, and discussion of specific problems with
CodeNotes authors and other developers.
Join our nonfiction newsletter by sending a blank e-mail to:
[email protected] or visit www.atrandom.com
Every CodeNotes title is written and reviewed by a team of commercial software developers and technology experts. See “About the Authors” at the front of the book for more information.
Related to CodeNotes for Oracle 9i
Related ebooks
Oracle Application Express 4.0 with Ext JS Rating: 0 out of 5 stars0 ratingsAdvanced Java Rating: 0 out of 5 stars0 ratingsDecoding Oracle Database: A Comprehensive Guide to Mastery Rating: 0 out of 5 stars0 ratingsOracle E-Business Suite R12 Integration and OA Framework Development and Extension Cookbook Rating: 0 out of 5 stars0 ratingsX++ Language Development Guide: Definitive Reference for Developers and Engineers Rating: 0 out of 5 stars0 ratingsMastering Oracle Database: From Basics to Expert Proficiency Rating: 0 out of 5 stars0 ratingsThe Future of Database Management Technologies: Harnessing the Power of Data: Insights and Strategies in Database Management Rating: 0 out of 5 stars0 ratingsA Practical Guide to Implement Oracle E-Business Suite Rating: 0 out of 5 stars0 ratingsBeginning Visual Basic 2010 Rating: 0 out of 5 stars0 ratingsQuick Start Guide to Oracle Fusion Development: Oracle JDeveloper and Oracle ADF Rating: 0 out of 5 stars0 ratingsOracle 12c For Dummies Rating: 0 out of 5 stars0 ratingsDelphi Programming Essentials: A Comprehensive Guide to Rapid Application Development Rating: 0 out of 5 stars0 ratingsBeginning Java Programming: The Object-Oriented Approach Rating: 0 out of 5 stars0 ratingsOracle SQL Developer 2.1 Rating: 0 out of 5 stars0 ratingsWeb Development Toolkit for Java Developers: Build dynamic, secure, and scalable web applications with Java (English Edition) Rating: 0 out of 5 stars0 ratingsDatabase And Computer Management: SERIES 1, #3 Rating: 0 out of 5 stars0 ratingsJob Ready SQL Rating: 0 out of 5 stars0 ratingsArchitecture Body of Knowledge Rating: 0 out of 5 stars0 ratingsOracle® Financials Interview Questions: Unofficial Oracle Financials Certification Review Rating: 3 out of 5 stars3/5JDBC 4.0 and Oracle JDeveloper for J2EE Development Rating: 0 out of 5 stars0 ratingsDelphi Programming Essentials: Definitive Reference for Developers and Engineers Rating: 0 out of 5 stars0 ratingsT-SQL Techniques and Best Practices: Definitive Reference for Developers and Engineers Rating: 0 out of 5 stars0 ratingsIT Interview Questions & Best Answers Rating: 0 out of 5 stars0 ratingsJAVA Programming Simplified: From Novice to Professional - Start at the Beginning and Learn the World of Java Rating: 0 out of 5 stars0 ratingsOracle Database Mastery: Comprehensive Techniques for Advanced Application Rating: 0 out of 5 stars0 ratingsPractical Business Intelligence Rating: 3 out of 5 stars3/5Basics of Computer Rating: 0 out of 5 stars0 ratings
Internet & Web For You
Coding For Dummies Rating: 5 out of 5 stars5/5Notion for Beginners: Notion for Work, Play, and Productivity Rating: 4 out of 5 stars4/5The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 4 out of 5 stars4/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5How to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5The Digital Marketing Handbook: A Step-By-Step Guide to Creating Websites That Sell Rating: 5 out of 5 stars5/5More Porn - Faster!: 50 Tips & Tools for Faster and More Efficient Porn Browsing Rating: 3 out of 5 stars3/5Cybersecurity For Dummies Rating: 5 out of 5 stars5/5Canva Tips and Tricks Beyond The Limits Rating: 3 out of 5 stars3/5Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5Content Chemistry: The Illustrated Handbook for Content Marketing Rating: 5 out of 5 stars5/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5UX/UI Design Playbook Rating: 4 out of 5 stars4/5Principles of Web Design Rating: 0 out of 5 stars0 ratingsThe Basics of User Experience Design by Interaction Design Foundation Rating: 4 out of 5 stars4/5SEO For Dummies Rating: 4 out of 5 stars4/5Build a WordPress Website From Scratch 2024: WordPress 2024 Rating: 0 out of 5 stars0 ratingsThe Logo Brainstorm Book: A Comprehensive Guide for Exploring Design Directions Rating: 4 out of 5 stars4/5Web Coding & Development All-in-One For Dummies Rating: 1 out of 5 stars1/5Explain the Cloud Like I’m 10 Rating: 5 out of 5 stars5/5Get Started in UX: The Complete Guide to Launching a Career in User Experience Design Rating: 4 out of 5 stars4/548 Really Useful Web Sites Rating: 5 out of 5 stars5/5Tor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/52022 Adobe® Premiere Pro Guide For Filmmakers and YouTubers Rating: 5 out of 5 stars5/5
Reviews for CodeNotes for Oracle 9i
3 ratings1 review
- Rating: 5 out of 5 stars5/5
Nov 13, 2024
Thank You This Is Very Good, Maybe This Can Help You
Download Full Ebook Very Detail Here :
https://amzn.to/3XOf46C
- You Can See Full Book/ebook Offline Any Time
- You Can Read All Important Knowledge Here
- You Can Become A Master In Your Business
Book preview
CodeNotes for Oracle 9i - Gregory Brill
Chapter 1
INTRODUCTION
MODERN DATABASES
The database is an integral component of almost every large computer system. Whether you are building a consumer e-commerce website or developing more traditional client-server systems for in-house use, the database provides the critical central storage area for your data. By now, most developers will be familiar with the power of a relational database. Simply browsing the web almost always involves interacting with one or more highly tuned databases. However, a database is much more than simply a storage container for data.
Modern databases, such as Oracle 9i, provide many features that make the database a powerful development tool. Many of the tasks that used to be exclusively performed by middle-tier systems, such as data translation (e.g., database to XML, or vice versa), can now be executed directly in the database. Actions that used to be confined inside the databases (stored procedures) can now be extended to outside systems (e.g., Java extended stored procedures). Oracle 9i, for instance, can now call Java code external to the database from inside a stored procedure.
Many of these enhancements to the modern database take advantage of the optimized data storage systems and can provide tremendous performance advantages over traditional three-tier systems development. Additionally, many of these common tasks are now built-in features, accessible through simple Application Programming Interfaces (APIs).
Ultimately, this book explains how to exploit these modern database enhancements. It’s a hands-on, practical guide, written for all ranges of Oracle developers. Most important, this book will make you productive with Oracle 9i in as short a time as possible. As you read this book, our hope is that you will come to appreciate the tools associated with Oracle 9i, as well as learn to build powerful and flexible database applications.
Oracle Products
The Oracle 9i database is actually one component within a suite of products, although it is definitely the heart of the product line. At the time of this writing, additional top-level Oracle products include:
Oracle 9i Application Server (Oracle 9i AS)—Oracle 9i AS delivers J2EE performance with the reliability and security needed for professional business applications and websites.
Oracle E-Business Suite 11i—A complete set of business applications designed to run entirely on the Internet. Oracle E-Business Suite 11i allows companies to cut costs across customer relationship management, supply chain, financial, project, human resources, and business intelligence functions.
Oracle 9i JDeveloper—Oracle 9i JDeveloper is a J2EE/XML development environment designed to debug and deploy e-business applications and web services, quickly and easily.
As you will see throughout this book, each of these top-level products actually contains a wide variety of subcomponents. Throughout this book, we have tried to limit the use of the word Oracle to refer to either the Oracle Corporation or the Oracle database. All other Oracle products are referred to by their proper names.
Oracle and Java
Whether you are building Java stored procedures, integrating Oracle with an LDAP system, or simply using objects in your database, you will find that Oracle and Java are fairly inseparable. Almost every Oracle 9i component relies heavily on the Java language. The Oracle Corporation has been a major player in the definition of many of the Java specifications, particularly with regard to database access, security models, and the various components of J2EE. Because of this association, all of the Oracle GUI tools are written in Java, and Java is the language of choice for working with Oracle.
Oracle History
Founded in 1977, Oracle Corporation has become one of the leading software companies in the world. The Oracle Corporation actually introduced the first commercial SQL database back in 1979. Since then, Oracle’s innovations and products have continued to have a significant impact on information technology.
In 1999, Oracle released Oracle 8i, which added a host of features including the ability to create and store complete objects (Oracle 8), as well as a combination of enhancements that made the database ready for Internet computing (Oracle 8i). These enhancements dramatically improved the performance and scalability of the database and set the foundation for Oracle 9i.
Oracle 9i is the latest incarnation of Oracle’s web-enabled database. It adds a host of Internet computing enhancements, Real Application Clusters, Advanced Analytical Services, along with many additional self-tuning, management, and data warehousing features. Ultimately, Oracle 9i creates a complete package of Internet-ready tools that address the highly varied needs of database developers.
Released in June 2001 for Unix/Linux and October 2001 for Windows, Oracle 9i has continued converting core components to interconnect with Java and the Internet. Oracle’s commitments to both Java and the Internet are fundamental to every aspect of the Oracle family of products. The various database management tools are all web-enabled, and the database (through JSP and Servlets) supports direct web access.
ADDITIONAL RESOURCES
Whether you are encountering Oracle for the first time or are an old hand, you may find that the following websites are essential resources:
The Oracle Technology Network (OTN)—The OTN is Oracle’s central resource site for Oracle users and developers. If Oracle has ever published a white paper, book, or article on a subject, you can find it on the OTN. Some areas of the OTN require that you register for a free login. In particular, if you follow the instructions in Chapter 2 to download and install an Oracle database, you will need an OTN login. The homepage for the OTN is http://otn.oracle.com.
Oracle Security Alerts—If you are working with a database that must be secure, you should keep an eye on Oracle’s security-alerts web page: (http://otn.oracle.com/deploy/security/alerts.htm). This page contains links to all of the latest patches, updates, and security notifications related to the Oracle database and any other Oracle products.
Oracle Online Documentation Search—One of the more obscure but useful Oracle sites is the online documentation search facility (http://download-east.oracle.com/otndoc/oracle9i/901_doc/index.htm). Not only does this facility provide access to all of the online books, it also has an error message lookup function. You should definitely bookmark this site in your browser as it is a great starting point for quick answers to questions like What does an ORA-00231 error really mean, and what can I do about it?
In addition to these Oracle-sponsored sites, there are many third-party and user-generated websites that contain an amazing amount of information on Oracle and development in Oracle. See OR010003 for links to some of these resources.
THE ROAD MAP
Chapter 1: Introduction—As you have read in this chapter, the Oracle database is much more than a simple container for your data. In the following chapters you will learn how to work with Oracle from a developer’s point of view.
Chapter 2: Installation—Before experimenting with any of the exercises or examples in this book, you must have access to an Oracle 9i database. This chapter provides instructions on downloading, installing, and configuring the developer’s copy of Oracle 9i freely available from the Oracle website. This chapter also details the database we will use for the remaining chapters. Even if you already have access to an Oracle 9i instance, you should still read the Database Configuration part of this chapter to ensure that your database is properly configured for the examples presented throughout the book.
Chapter 3: Oracle Basics—Before diving into the more advanced features of Oracle 9i, you should have a proper grounding in Oracle basics. This chapter explains the Oracle database framework, provides some guidance on database design, discusses creating and using indexes, and illustrates some basic administration functions such as backup and recovery. This chapter is meant as a refresher for users experienced with Oracle and a fast introduction for developers and new Oracle users.
Chapter 4: SQL and PL/SQL—A database without programmatic access is simply a storage container for data. Using the Structured Query Language (SQL) you can insert, extract, and modify data inside your database. This chapter will also introduce you to Oracle’s Procedural Language/SQL (PL/SQL), which can be used to create complex code, stored procedures, and triggers. Although this chapter is not intended as a complete SQL or PL/SQL reference, it should provide you with a solid grounding on the specific way in which Oracle 9i supports the SQL-99 standard and on how PL/SQL works.
Chapter 5: Performance Tuning—One of the areas where programmers and database administrators disagree the most is in regard to performance tuning. Is the slowdown in the program, the network, or the database? This chapter examines strategies for isolating and removing performance problems.
Chapter 6: Oracle and Java—As mentioned earlier, it is almost impossible to separate Oracle 9i from Java. In this chapter, you will see how to use Java within the database, how to access external Java objects from inside the database, and how to use Oracle 9i as an object-oriented database.
Chapter 7: Oracle and XML—The rapid acceptance of XML as a data communication format has resulted in the need for improved XML support from the database. With Oracle 9i, the Oracle database is capable of not only generating XML from a query and inserting data into tables from an XML format; it can also store and index XML content directly. This chapter illustrates the full power of the Oracle 9i XML Developers Kit and Oracle Text.
Chapter 8: Advanced Features—The Oracle 9i family of products includes many advanced features and optional components. This final chapter provides a quick look at some of the components and systems that are beyond the scope of this particular installment of CodeNotes.
Chapter 2
INSTALLATION
In order to work with the examples in this book, you must have access to an installation of Oracle 9i. If you already have access to an installation, including administrative user access, then you can skip ahead to the section on loading the database at the end of this chapter. However, if you want to install a copy of Oracle 9i on a local system, the first part of this chapter illustrates the process of installing the free Oracle 9i evaluation copy on both Windows and Unix environments.
This chapter assumes that you are installing the Oracle 9i database on either Windows 2000 or Sun SPARC Solaris. See OR020010 for information on installing Oracle on other platforms.
Oracle 9i Installation Patterns
The Oracle 9i suite of products has four typical installation patterns:
Enterprise Edition—This edition is the most complete version, and includes many development tools and extended features such as a preconfigured starter database, networking services, licensable Oracle Options, database environment tools, the Oracle Enterprise Manager framework of management tools (including Console, Management Server, and Intelligent Agent), Oracle utilities, and online documentation. The Enterprise Edition also contains products used for data warehousing and transaction processing.
Standard Edition—Oracle 9i Standard Edition installs a preconfigured starter database, networking services, Oracle Enterprise Manager Console, and Oracle utilities.
Personal Edition—The Personal Edition is most suitable for creating small databases that do not require extensive customization or control.
Custom—The Custom installation option allows you to pick and choose which components you want to install.
For the purposes of this book, you should install the Enterprise Edition. The following table lists the recommended system requirements for all Oracle 9i database versions, on both Windows 2000 and Sun SPARC Solaris.
Table 2.1 Oracle 9i database system requirements for Windows and Unix
Most Unix-based installations require additional operating-system patches, JRE patches, and JDK patches. For the most current installation information concerning Oracle 9i system requirements, please refer to the release notes for your operating system, located at http://docs.oracle.com.
DOWNLOAD AND INSTALL ORACLE 9I DATABASE
You may download a free copy of the Oracle 9i database (or any other Oracle product) from the Oracle Technology Network (OTN), located at http://technet.oracle.com. The OTN is a site dedicated to providing developers with the best information on Oracle products and technologies. However, in order to download the software or read through many of the articles, you must obtain a free subscription to the OTN.
Download the Database
The following download instructions assume that you have an existing account with OTN. If you do not have an account with OTN, you will be prompted to start an account during the downloading procedure. Once you have created an account with OTN, continue following these instructions to download the Oracle 9i database.
All Installations
Before continuing on either platform, you must download the Oracle 9i database distribution.
Visit the Oracle Technology Network site at http://technet.oracle.com.
Go to the Free Downloads section of this site. You will be brought to the Download Oracle Products, Drivers, and Utilities page.
Select 9i Database from the dropdown menu. You will be brought to the Oracle 9i Database Downloads page.
Select the appropriate Oracle version (Oracle 9i Database Enterprise Edition) and operating system (Windows 2000 or Sun SPARC Solaris) for your database.
You will be brought to the Oracle Technology Network Developers License Terms page. Fill out the license form and accept the agreement.
Download all three files to your computer. (Download the zip files for Windows and the gzip/cpio files for Solaris.) The files are very large (approximately 590 Mb, 540 Mb, and 200 Mb for Windows) so be prepared for a long download process.
Unpack the Installation
The following instructions will walk you through unpacking the download into the required directories.
Windows 2000 Installation
Create directories Disk1, Disk2, and Disk3 underneath a common directory (e.g., c:\oracle). Move each zip file into the appropriate directory (e.g., Disk1.zip into c:\oracle\Disk1).
From a command prompt, navigate to the Disk1 directory and unzip the 9011NTSrv_Disk1.zip. Make sure that you unzip the files using the use folders
option. Depending on your zip tool, you may be asked to replace several files. The zip packages contain several duplicate files and you should keep the newest versions. Repeat this step for Disk2 and Disk3, using their corresponding zip files.
Once you complete these steps, you can safely delete the original zip files.
Sun SPARC Solaris Installation
In order to install Oracle 9i on Sun SPARC Solaris, you must first perform some preliminary tasks that require root user access. These tasks set up two users, Oracle and APACHE, and several user groups that are required by the Oracle database.
Log in to your computer as the root user.
Create the database administrator groups using the groupadd command.
Listing 2.1 Adding the groups
The dba group is generally referred to as OSDBA, the oper group is referred to as OSOPER and the oinstall group is ORAINVENTORY. These alternate names appear in all of the Oracle installation literature.
Add the oracle user to the database administrator groups using the useradd command. Ensure that the user’s primary group is the ORAINVENTORY group, and that the secondary group is the OSDBA group. We can also use the useradd command to create the Oracle home directory (/export/home/oracle). The home directory will be where we do the actual installation of Oracle 9i.
Listing 2.2 Adding the Oracle user
If the useradd can’t create the home directory for you, you can create it yourself by copying the /export/home/skel directory into a new directory called /export/home/oracle.
Add a new user named apache. This user will be required to support the Oracle web components. The apache user should be assigned to the ORAINVENTORY group and to a secondary group called apache.
Listing 2.3 Adding the Apache user
Set the passwords for both the oracle and apache users.
Create a temporary directory for the Oracle installation files (e.g., /oratemp). This directory will only be required until the installation is complete.
Decompress all three files into your temp directory. Repeat this step for the Disk2 and Disk3 files.
Listing 2.4 Unzipping the files
Create a subdirectory called /oratemp/disk1. Change your working directory into this directory.
Extract the 901Solaris_Disk1.cpio into the /oratemp/disk1 directory.
Listing 2.5 Extracting the files. Only the -l and -d options are strictly required
Repeat steps 8 and 9 for 901Solaris_Disk2.cpio.gz and 901Solaris_Disk3.cpio.gz, changing both the file name and the directory name.
Once you complete these steps, you can delete the original archive files.
This process should result in a temporary directory that contains the Oracle installation file structure. You can safely delete the /oratemp directory after you complete the remaining installation steps.
Oracle 9i Database Installation
Once you have downloaded and unpacked the files, you must install Oracle. The installation process is fairly straightforward, although it can be time-consuming. A typical Oracle installation can take over an hour as Oracle builds its default database and configuration files.
These instructions assume you are performing a clean installation on a system that does not currently have an Oracle database installed. If you are installing Oracle 9i on top of an existing Oracle instance, see OR020003 for alternate instructions.
WINDOWS 2000 INSTALLATION
In order to install the Oracle 9i database on Windows 2000, you must have administrator-level access to your computer.
Log in to your computer as user with administrator access rights.
Navigate to your Disk1 directory from a command prompt (or Explorer window) and run setup.exe. The Oracle Universal Installer will appear.
In the Welcome window, select Next. The File Locations window will appear.
In the next window, the Source path should be the Disk1 directory. In the Destination window, make sure that the Name field contains OraHome90, and that the Path field is something like D:\oracle\ora90. Oracle will automatically choose the drive with the most disk space (D:\ in this case). The main Oracle files will be installed into the d:\oracle\ora90 directory. Additional directories may also be created in D:\oracle to contain external products.
When you click Next, Oracle will extract a product list and present you with the Available Products screen. You should select the Oracle 9i database