Db2 Developer's Guideby Craig S. Mullins
DB2 Developer's Guide, Fourth Edition is completely revised and updated, covering all the new features for Version 6 for OS/390. It includes a special chapter on how changes to the product impact its use. This book clarifies complex DB2 topics, provides performance and procedural advice for implementing well-designed DB2 applications, and describes what DB2 does behind the scenes. An entire chapter on Internet-related features is included.
Read an Excerpt
Chapter 1: The Magic WordsOnce upon a time there was a kingdom called Userville. The people in the kingdom were impatient and wanted to know everything about everything-they could never get enough information. Life was difficult and the people were unhappy because data was often lost, and even when it was available, it was often inaccurate and not easy to access.
The King decided to purchase DB2, an advanced tool for storing and retrieving data that could be processed by the Users and turned into information. "This," he thought, "should keep the people happy. DB2 will solve all my problems." But he soon found out that special knowledge was necessary to make DB2 work its wonders. Nobody in Userville knew how to use it.
Luckily, a grand Wizard living in a nearby kingdom knew many mystical secrets for retrieving data. These secrets were a form of magic called SQL. The King of Userville summoned the Wizard, offering him many great treasures if only he would help the poor Users in Userville.
The Wizard soon arrived, determined to please. Armed with nothing more than SQL and a smile, the Wizard strode to the terminal and uttered the magic words.
A crowd gathered and applauded as the desired information began pumping out of the terminal. "More, more," shouted the data-starved masses. The Wizard gazed into the screen, and with amazing speed effortlessly produced report after report. The King was overheard to say, "You know, this is just too good to be true!" Everybody was happy. The Users had their share of information, the King had a peaceful kingdom, and the Wizard had his treasures and the respect of the Users.
For many months, the Users were satisfied with the magic of the great Wizard. Then, one day, the Wizard disappeared ...in a jet to the West Coast for 130 grand a year. The people of the kingdom began to worry. "How will we survive without the magic of the Wizard? Will we have to live, once again, without our precious information?" The Wizard's apprentice tried to silence the crowd by using his magic, but it wasn't the same. The information was still there, but it wasn't coming fast enough or as effortlessly. The apprentice was not yet as skilled as the great Wizard who had abandoned the kingdom. But, as luck would have it, one day he stumbled upon the great Wizard's diary. He quickly absorbed every page and soon was invoking the Wizard's magic words. And all was well again.
Well, life is not always that simple. Departing Wizards do not often leave behind documentation of their secrets. The first part of this book can be used as a "Wizard's diary" for efficient SQL. This chapter is an overview of SQL, not from a syntactic viewpoint, but from a functional viewpoint. This chapter is not intended to teach SQL, but to provide a framework for the advanced issues discussed in the remainder of this text. This framework delineates the differences between SQL and procedural languages and outlines the components and types of SQL. Chapters 2 through 4 delve into the performance and administrative issues surrounding - the effective implementation of SQL for DB2.
So continue and take the next step toward becoming a DB2 Wizard...
An Overview of SQL
Structured Query Language, better known as SQL (and pronounced "sequel" or "ess-cue-el"), is a powerful tool for manipulating data. It is the de facto standard query language for relational database management systems (RDBMSs) and is used not just by DB2, but also by the other leading RDBMS products such as Oracle, Sybase, Informix, and Microsoft SQL Server. Indeed, every relational database management system-and many nonrelational DBMS products-provide support for SQL. Why is this so? What benefits are accrued by using SQL rather than some other language? There are many reasons. Foremost is that SQL is a high-level language that provides a greater degree of abstraction than do procedural languages. Third-generation languages (3GLs), such as COBOL, and older fourth-generation languages (4GLs), such as FOCUS, require that the programmer navigate data structures. Program logic must be coded to proceed record-byrecord through the data stores in an order determined by the application programmer or systems analyst. This information is encoded in the high-level language and is difficult to change after it has been programmed. SQL, on the other hand, is fashioned so that the programmer can specify what data is needed but cannot specify how to retrieve it. SQL is coded without embedded data-navigational instructions. The DBMS analyzes SQL and formulates data-navigational instructions "behind the scenes." These data-navigational instructions are called access paths. By forcing the DBMS to determine the optimal access path to the data, a heavy burden is removed from the programmer. In addition, the database can have a better understanding of the state of the data it stores, and thereby can produce a more efficient and dynamic access path to the data. The result is that SQL, used properly, provides a quicker application development and prototyping environment than is available with corresponding high-level languages.
Another feature of SQL is that it is not merely a query language. The same language used to query data is used also to define data structures, control access to the data, and insert, modify, and delete occurrences of the data. This consolidation of functions into a single language eases communication between different types of users. DBAs, systems programmers, application programmers, systems analysts, systems designers, and end users all speak a common language: SQL. When all the participants in a project are speaking the same language, a synergy is created that can reduce overall system-development time...
Meet the Author
Craig S. Mullins is Director of DB2 Technology Planning for BMC Software, Inc. He has extensive experience in all facets of database systems development, including systems analysis and design, database and system administration, data analysis, and developing and teaching DB2 and Sybase classes. Craig has worked with DB2 since Version 1 and has experience in multiple roles, including programmer, DBA, instructor, and analyst. His experience spans industries, having worked for companies in the following fields: manufacturing (USX Corporation), banking (Mellon Bank), utilities (Duquesne Light Company), commercial software development (BMC Software, PLATINUM Technology, Inc.), consulting (ASSET, Inc.), and computer industry analysis (Gartner Group). Additionally, Craig authored many of the popular "Platinum Monthly DB2 Tips" and worked on Platinum's DB2 system catalog and access path posters.
Most Helpful Customer Reviews
See all customer reviews
This is a great book packed with lots of information on DB2 and also SQL. Although its not a SQL book it has some good examples of real world scripts. Good reference for any programmer who uses DB2, beginner or experienced.