• To understand the purpose and role of stored procedures • To understand the fundamental features of MySQL

• To understand the purpose and role of stored procedures • To understand the fundamental features of MySQL

and know how to create simple stored procedures. backup and recovery facilities.

A complete version of this chapter is available on this textbook’s Web site. Go to www.pearsonhighered.com/kroenke and select the Companion Website for this book.

The three chapters in this section examine standards for database application processing. We begin in Chapter 11 by discussing database access standards, including ODBC, ADO.NET and ASP.NET in Microsoft’s .NET Framework, and the Java-based JDBC and Java Server Pages (JSP) technologies. Even though some of these standards are no longer on the leading edge of database processing, many applications still use them, and you will likely encounter them in your career. Chapter 11 then describes the use of the popular PHP scripting language to create Web pages that access the View Ridge Gallery database.

Chapter 12 discusses one of the most important developments in information technology today—the confluence of database processing and document processing. This chapter introduces you to XML and XML Schema. Chapter 13 discusses business intelligence (BI) systems and the data warehouse and data mart databases that support them.

The Web Server Environment

Chapter Objectives

• To understand the nature and characteristics of the data • To understand the characteristics of JDBC and the four

environment that surrounds Internet technology database

types of JDBC drivers

• To understand the nature of JSP and know the differences • To learn the purpose, features, and facilities of ODBC

applications

between JSP and ASP.NET

• To understand the characteristics of the Microsoft .NET • To understand HTML and PHP

• To be able to construct Web database applications pages • To understand the nature and goals of OLE DB

Framework

using PHP

• To learn the characteristics and object model of ADO.NET

This chapter discusses some traditional standard interfaces and current tools for accessing database servers. ODBC, or the Open Database Connectivity standard, was developed in the early 1990s to provide a product-independent interface to relational and other tabular data. In the mid-1990s, Microsoft announced OLE DB, which is an object-oriented interface that encapsulates data-server functionality. Microsoft then developed Active Data Objects (ADO), which is a set of objects for utilizing OLE DB that is designed for use by any language, including VBScript and JScript. This technology was used in Active Server Pages (ASP), which were the basis of Web database applications. In 2002, Microsoft introduced the .NET Framework, which included ADO.NET

Chapter 11 The Web Server Environment

(the successor to ADO) and ASP.NET (the successor to ASP) components. Today, the .NET Framework is the basis for all application development using Microsoft technology.

As an alternative to the Microsoft technologies, Sun Microsystems (pur- chased by Oracle Corporation in 2010) developed the Java platform, which includes the Java programming language, Java Database Connectivity (JDBC) and Java Server Pages (JSP).

Although the .NET and Java technologies are important development platforms, additional technologies have been developed by other companies and open-source projects. We will use two of these independently developed tools in this chapter––the Eclipse integrated development environment (IDE) and the PHP scripting language.

However, before considering these standards, we need to gain some perspective on the data environment that surrounds the Web server in Internet technology database applications.

The Web Database Processing Environment

The environment in which today’s database applications reside is rich and complicated. As shown in Figure 11-1, a typical Web server needs to publish applications that involve data of dozens of different data types. So far in this text, we have considered only relational databases, but as you can see from this figure, there are many other data types as well.

Consider the problems that the developer of Web server applications has when integrating these data. The developer may need to connect to an Oracle database; a DB2 mainframe database; a nonrelational database, such as IMS, IBM’s older DBMS product; file-processing data, such as VSAM and ISAM; e-mail directories; and so forth. Each one of these products has

a different programming interface that the developer must learn. Further, these products

Figure 11-1

Relational Databases: Oracle Database,

The Variety of Data Types in Microsoft SQL Server, Web Database Applications

Oracle MySQL, Microsoft Access, IBM DB2 . . .

Browser

Nonrelational Databases

Browser

Web

VSAM, ISAM, Other

Server

File Processors

Browser

E-mail, Other Document Types

Pictures, Audio, Other????

Part 5 Database Access Standards

evolve, thus new features and functions will be added over time that will increase the developer’s challenge.

Several standard interfaces have been developed for accessing database servers. Every DBMS product has an application programming interface (API). An API is a collection of objects, methods, and properties for executing DBMS functions from program code. Unfortu- nately, each DBMS has its own API, and APIs vary from one DBMS product to another. To save programmers from having to learn to use many different interfaces, the computer industry has developed standards for database access.

The Open Database Connectivity (ODBC) standard was developed in the early 1990s to provide a DBMS-independent means for processing relational database data. In the mid-1990s, Microsoft announced OLE DB, which is an object-oriented interface that encapsulates data-server functionality. OLE DB was designed not just for access to relational databases, but also for accessing many other types of data as well. As a Component Object Model (COM) interface, OLE DB is readily accessible to programmers through the use of programming languages such as C, C#, and Java. However, OLE DB is not as accessible to users of Visual Basic (VB) and scripting languages. Therefore, Microsoft developed Active Data Objects (ADO), which is a set of objects for utilizing OLE DB that is designed for use by any language, including Visual Basic (VB), VBScript, and JScript. ADO has now been followed by ADO.NET (pronounced “A-D-O-dot-NET”), which is an improved version of ADO developed as part of Microsoft’s .NET (pronounced “dot-NET”) initiative and a component of the .NET Framework.

ADO technology is used in Active Server Pages (ASP) Web pages to create Web-based data- base applications. ASP is a combination of Hypertext Markup Language (HTML) and VBScript or JScript that can read and write database data and transmit it over public and private networks, using Internet protocols. ASP runs on Microsoft’s Web server product, Internet Information Services (IIS). When ADO.NET was introduced, Microsoft also introduced ASP.NET. ASP.NET is the successor to ASP and is the preferred Web page technology in the .NET Framework.

Of course, there are other connectivity methods and standards besides those propagated by Microsoft. The main alternatives to ADO.NET technology are based on or associated with Sun Microsystems’ (now Oracle Corporation’s) Java platform and include the Java programming language, Java Database Connectivity ( JDBC), Java Data Objects ( JDO), and JavaServer Pages ( JSP).

JSP technology is a combination of HTML and Java that accomplishes the same function as ASP.NET by compiling pages into Java servlets. JSP may connect to databases using JDBC. JSP is often used on the Apache Tomcat, which implements JSP in an open-source Web server (and is often used in conjunction with the open-source Apache Web server).

However, the defining characteristic of the Java-related technology is that you must use Java as the programming language. You cannot even use JavaScript, Java’s somewhat-related scripting language cousin. If you know (or want to learn) Java, this if fine.

Although the Microsoft .NET Framework and the Sun Microsystems’ (now Oracle Corporation’s) Java platform are the two major players in Web database application develop- ment, other options are available. One such product is PHP, which is an open-source Web page programming language, and another favorite combination of Web developers is the Apache Web server with the MySQL DBMS and the PHP language. This combination is called AMP (Apache-MySQL-PHP). When running on the Linux operating system, it is referred to as LAMP; when running on the Windows operating system, it is referred to as WAMP. And because PHP works with all DBMS products, we will use it in this book. Other possibilities include the Perl and Python languages (both of which can be the “P” in AMP, LAMP, or WAMP), and the Ruby language with its Web development framework called Ruby on Rails.

In a Web-based database processing environment, if the Web server and the DBMS can run on the same computer, the system has two-tier architecture. (One tier is for the browsers, and one is for the Web server/DBMS computer.) Alternatively, the Web server and DBMS can run on different computers, in which case the system has three-tier architecture. High-performance applications might use many Web server computers, and in some systems several computers can run the DBMS, as well. In the latter case, if the DBMS computers are processing the same databases, the system is referred to as a distributed database. Distributed databases were discussed in Chapter 9.

Chapter 11 The Web Server Environment

The ODBC Standard

The ODBC standard was created to address the data access problem that concerns relational databases and data sources that are table-like, such as spreadsheets. As shown in Figure 11-2, ODBC is an interface between the Web server (or other database application) and the DBMS. It consists of a set of standards by which SQL statements can be issued and results and error messages can be returned. As shown in Figure 11-2, developers can call the DBMS using native DBMS interfaces (which are APIs) if they want to (sometimes they do this to improve performance), but the developer who does not have the time or desire to learn many different DBMS native libraries can use the ODBC instead.

The ODBC standard is an interface by which application programs can access and process databases and tabular data in a DBMS-independent manner. This means, for example, that an application that uses the ODBC interface could process an Oracle Database database, an SQL Server database, a spreadsheet, or any other ODBC-compliant database without making any coding changes. The goal is to allow a developer to create a single application that can access databases supported by different DBMS products without needing to be changed, or even recompiled.

ODBC was developed by a committee of industry experts from the X/Open and SQL Access Group committees. Several such standards were proposed, but ODBC emerged as the winner, primarily because it had been implemented by Microsoft and is an important part of Windows. Microsoft’s initial interest in support of such a standard was to allow products such as Microsoft Excel to access database data from a variety of DBMS products without having to be recompiled. Of course, Microsoft’s interests have changed since the introduction of OLE DB and ADO.NET.