Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3rd Edition Chapter Seven Database Processing Applications and Business Intelligence Chapter Objectives • Understand and be able to set up Web database processing • Learn the basic concepts of Extensible Markup Language (XML) • Learn the basic concepts of business intelligence (BI) systems • Learn the basic concepts of OLAP and data mining KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-2 Heather Sweeney Designs: Database Design KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-3 Heather Sweeney Designs: HSD Database Diagram in SQL Server 2005 KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-4 Database Processing Environment • A database processing environment is complicated and multi-faceted – Multiple users – Multiple queries – Multiple forms – Multiple reports – Multiple application programs KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-5 The Database Processing Environment KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-6 Queries, Forms, and Reports Microsoft Access is being used to create forms and reports for a database running in SQL Server 2005 Express Edition KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-7 Processing Constraints • • • • • • • • Enforcing referential integrity Cascading deletion Cascading modifications Data type constraints Data size constraints Data value constraints Null constraints Uniqueness constraints KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-8 Triggers and Stored Procedures • A trigger is a stored procedure that is automatically invoked by the DBMS when a specified activity occurs – BEFORE, AFTER and INSTEAD OF • A stored procedure is a module similar to subroutine or function that performs database actions – Stored in the database itself KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-9 Internet Application Processing • Internet Application Processing is more complicated than traditional application processing • Specifically, with Internet Application Processing … – The network becomes an integral part of the application KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-10 Internet Application Processing Environment KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-11 APIs • Every DBMS product has an application program interface (API) – An API is a collection of objects, methods, and properties for executing DBMS functions from program code – Each DBMS has its own API, and APIs vary from one DBMS product to another. • To simplify this situation, the computer industry has developed standards for database access • API interface standards are used to make it easier for programmers – they write to the interface standard instead of the DBMS API – ODBC – Open Database Connectivity – JDBC – Java Database Connectivity KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-12 OBDC and OLE DB • The Open Database Connectivity (ODBC) standard was developed in the early 1990s – Provides a DBMS-independent means for processing relational database data • OLE DB was created by Microsoft in the mid1990s – An object-oriented interface – Encapsulates data-server functionality – Designed not just for access to relational databases, but also for accessing many other types of data as well – Readily accessible to programming languages such as C, C#, and Java – Not as accessible to Visual Basic and scripting languages KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-13 ADO and ADO.NET • Microsoft developed Active Data Objects (ADO) – A set of objects for utilizing OLE DB – Designed for use by any language, including VB, VBScript, and Jscript • ADO has been followed by ADO.NET – An improved version of ADO developed as part of Microsoft’s .NET initiative KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-14 ODBC, OLE DB, and ADO in the Web Database Processing Environment KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-15 N-Tier Architecture • Tiers refers to the number of computers involved in the Web database application – The workstation with Web browser is the first tier – Two-tier architecture means that the Web server and the DBMS are on the same server – Three-tier architecture means that the Web server and the DBMS are on separate servers KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-16 Typical Web Server Setups Microsoft Windows Linux or Unix Web Server Internet Information Apache Server (IIS) Scripting Languages (Interpreted ASP Pages with VBScript or JScript (PHP also works) PHP Object Oriented Languages (Complied) ASP.NET pages with VisualBasic.Net, C#.Net or others JSP pages with Java (Also see the Mono project) KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-17 Typical Web DBMS Servers Microsoft Windows Linux or Unix Web Server Internet Information Apache Server (IIS) DBMSs Microsoft SQL Server Oracle MySQL API Interface Standard ODBC JDBC KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-18 ODBC: Three-tier Web Server Architecture KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-19 ODBC Architecture • The application program, the ODBC driver manager, and the ODBC DBMS driver all reside on the Web server • The DBMS driver sends requests to data sources on the database server – A data source is the database, its associated DBMS, operating system, and network platform KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-20 ODBC Architecture: The Application Program • The application program issues requests – – – – To create a connection with a data source To issue SQL statements and receive results To process errors To start, commit, and roll back transactions • ODBC – Provides a standard means for each of these requests – Defines a standard set of error codes and messages KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-21 ODBC Architecture: The ODBC Driver Manager • The ODBC driver manager – Serves as an intermediary between the application and the DBMS drivers – When the application requests a connection, the driver • Determines the type of DBMS that processes a given ODBC data source • Loads the appropriate driver into memory (if it is not already loaded) KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-22 ODBC Architecture: The ODBC Driver • A ODBC driver – Processes ODBC requests – Submits specific SQL statements to a given type of data source • There is a different driver for each data source type • It is the responsibility of the driver to ensure that standard ODBC commands execute correctly – Converts data source error codes and messages into the ODBC standard codes and messages KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-23 ODBC Architecture: ODBC Data Sources • An ODBC data source – Is an ODBC data structure that identifies a database and the DBMS that processes it – There are three types of data sources • A file data source is a file that can be shared among database users—The only requirement is that the users have the same DBMS driver and privilege to access the database. • A system data source is one that is local to a single computer—The operating system and any user on that system (with proper permissions) can use a system data source • A user data source is available only to the user who created it – Each created data source is given a data source name (DSN) that is used to reference the data source. KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-24 ODBC Architecture: Creating an ODBC Data Source I KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-25 ODBC Architecture: Creating an ODBC Data Source II KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-26 ODBC Architecture: Creating an ODBC Data Source III KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-27 IIS: The wwwroot Folder KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-28 IIS: The IIS Management Program KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-29 IIS: The IIS Localstart Web Page KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-30 Web Pages: HTML Code for default.htm <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Heather Sweeney Designs Demonstration Pages Home Page</title> </head> <body> <P align="center"> <font face="" color="#0000ff" size="6"> Database Concepts (3rd Edition) </font> </P> <p align="center"> <b>David M. Kroenke (University of Washington)</b> </p> <p align="center"> <b>David J. Auer (Western Washington University)</b> </p> <hr> <p align="center"> <font size="5"> Welcome to the Heather Sweeney Designs Home Page </font> </p> <hr> <p>Chapter 7 Demonstration Pages from Figures in the Text:</p> <p>Example 1: <a href="ReadSeminar.asp"> Display the SEMINAR Table (No surrogate key) </a> </p> <hr> </body> </html> KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-31 Web Pages: The default.htm Web Page KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-32 Web Pages: The ReadSeminar.asp Web Page KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-33 Active Data Objects (ADO): Abstractions, Objects and Collections • An abstraction is a generalization of something – • • ODBC interfaces are abstractions of native DBMS access methods When we abstract something, we lose detail, but we gain the ability to work with a broader range of types An object-oriented programming object is an abstraction that is defined by its properties and methods – Properties represent characteristics or attributes of the object – Methods are actions that the object can perform • A collection is an object that contains a group of other objects – Being an object, a collection has properties and methods – In ADO, collections are named as the plural of the objects they collect • One of the properties of all collections is Count, which is the number of objects in the collection. • An important method of a collection is an iterator, which is a method that can be used to pass through or otherwise identify the items in the collection KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-34 Active Data Objects (ADO): The ADO Object Model I KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-35 Active Data Objects (ADO): The ADO Object Model II • The Connection object is the first ADO object to be created and is the basis for the others • From a connection, a developer can create one or more RecordSet objects and one or more Command objects – Each RecordSet object has a Fields collection • Each Field element corresponds to a column in the recordset – Each Command object has a Parameters Collection • Contains Parameter objects which are the parameters needed by the command • In the process of creating or working with any of these objects, ADO will place any errors (error objects) that are generated in the Errors collection KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-36 Active Data Objects (ADO): ADO Constants in the ADOVBS.inc File • Isolation levels KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-37 Active Data Objects (ADO): ADO Constants in the ADOVBS.inc File • Cursor types KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-38 Active Data Objects (ADO): ADO Constants in the ADOVBS.inc File • Lock types KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-39 Active Data Objects (ADO): Referencing the ADOVBS.inc File Adovbs.inc is referenced in this line KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-40 Active Data Objects (ADO): The Connection Object The ADO adXactReadCommitted isolation level in Adovbs.inc is referenced in this line KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-41 Active Data Objects (ADO): The RecordsetObject The ADO adOpenStatic cursor type Adovbs.inc is referenced in this line The ADO adLockReadOnly lock type in Adovbs.inc is referenced in this line KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-42 Active Data Objects (ADO): The Fields Collection The ADO Count property The ADO iteration method KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-43 Active Data Objects (ADO): The Errors Collection In current code: More complete version: KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-44 Database Processing with XML • Extensible Markup Language (XML) is a standard for defining the structure of documents and communicating the documents among computers • It provides user definable tags that can be used in Web pages and other documents KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-45 Sample XML document KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-46 XML Schema Documents • XML schema documents define allowable tags and their relationships KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-47 XML Document Validation • An XML document can declare the name and location of the schema that defines its tags • XML documents that conform to their XML schemas are schema-valid documents • XML schema documents are XML documents, and can be validated against their designated schema • The “Schema of all schemas” is at www.w3.org/2001/XMLSchema KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-48 Sample XML Schema KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-49 XML and Database Processing • DBMS programs are incorporating means to read and create XML documents • SQL Server 2005 example: SELECT FROM * ARTIST FOR XML AUTO, ELEMENTS; KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-50 SQL for XML Processing SQL statement using XML The results are in one cell KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-51 Results of SQL for XML Processing The expanded results KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-52 Text Results of SQL for XML Processing KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-53 XLM Web Services • XML Webs Services allows application functionality on one Web server to be shared and incorporated into Web applications on other Web servers KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-54 Business Intelligence Systems • Business intelligence (BI) systems are information systems that – Assist managers and other professionals in the analysis of current and past activities and in the prediction of future events – Do not support operational activities, such as the recording and processing of orders • These are supported by transactin proccessing systems – Support management assessment, analysis, planning, and control • BI systems fall into two broad categories – Reporting systems that sort, filter, group, and make elementary calculations on operational data – Data mining applications that perform sophisticated analyses on data, analyses that usually involve complex statistical and mathematical processing KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-55 The Relationship Among Operational and BI Applications KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-56 OLAP and Data Mining • OnLine Analytical Processing (OLAP) is a technique for dynamically examining database data – OLAP uses arithmetic functions such as Sum and Average • Data Mining is a mathematically sophisticated technique for analyzing database data – Data mining use mathematical and statistical techniques KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-57 OLAP • OLAP uses a table called an OLAP cube • The OLAP cube uses inputs called dimensions • The OLAP cube calculates outputs called measures KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-58 Sample OLAP Cube KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-59 Data Mining Techniques • Data Mining mathematical and statistical techniques include: – Cluster analysis – Regression analysis – Time-series analysis – Factor analysis – Nonparametric Monte Carlo analysis KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall 7-60 DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3rd Edition End of Presentation on Chapter Seven Database Processing Applications and Business Intelligence