+ All Categories
Home > Documents > Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not...

Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not...

Date post: 19-Dec-2015
Category:
View: 213 times
Download: 0 times
Share this document with a friend
Popular Tags:
47
Prentice Hall © 2004 1 COS 346 Day 21 Day 21
Transcript
Page 1: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

Prentice Hall © 20041

COS 346

Day 21Day 21

Page 2: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

7-2

Agenda

• Capstone Progress report due• Assignment 9 not corrected yet • Assignment 10 posted (last one!!!)

– Due April 27 @ 2 PM– Lowest Assignment score will be dropped

• XML and ADO.NET on April 23• Quiz 3 on April 27

– SQL Chap 8-11– DP Chaps 8, 9, 11, 12 and 13– 20 M/C @ 4 points each– 4 short essays @ 5 points each– 60 mins, Open book, Open notes

• Capstones Due on April 27 • Discussion on Database Access Standards

Page 3: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-3

David M. Kroenke’s

Chapter Twelve:

ODBC, OLE DB, ADO, and ASP

Part One

Database Processing:Fundamentals, Design, and Implementation

Page 4: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-4

Introduction

• Because database applications today reside in a complicated environment, various standards have been developed for accessing database servers.

• Some of the important standards are– OBDC (Open Database Connectivity) is the early standard for

relational databases.– OLE DB is Microsoft’s object-oriented interface for relational and

other databases.– ADO (Active Data Objects) is Microsoft’s standard providing

easier access to OLE DB data for the non-object-oriented programmer.

Page 5: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-5

The Web Server Data Environment

• A Web server needs to publish applications that involve different data types.

Page 6: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-6

The Role of the ODBC Standard

Page 7: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-7

The Role of ODE DB

Page 8: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-8

The Role of ADO

Page 9: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-9

Open Database Connectivity (OBDC)

• The Open Database Connectivity (ODBC) standard provides a DBMS-independent means for processing relational database data.

• It was developed in the early 1990s by an industry committee and has been implemented by Microsoft and many other vendors.

• 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 recompiled.

Page 10: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-10

ODBC Architecture

Page 11: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-11

OBDC Components (Continued)

• OBDC consists of a data source, an application program, a driver manager, and a DBMS driver.

• A data source is the database and its associated DBMS, operating system, and network platform.– An ODBC data source can be a relational database, a

file server, or a spreadsheet.

• An applications program issues requests to create a connection with a data source.

Page 12: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-12

OBDC Components

• A driver manager determines the type of DBMS for a given ODBC data source and loads that driver in memory.

• A DBMS driver processes ODBC requests and submits specific SQL statements to a given type of data source.– A single-tier driver processes both ODBC calls and

SQL statements.– A multiple-tier driver processes ODBC calls, but

passes the SQL requests to the database server.

Page 13: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-13

ODBC Driver Types:ODBC Single-Tier Driver

Page 14: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-14

ODBC Driver Types:ODBC Multiple-Tier Driver

Page 15: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-15

Conformance Levels

• Levels of conformance balance the scope of the OBDC standard.

• There are two types of conformance levels:– ODBC conformance levels concern the features and

functions that are made available through the driver’s application program interface (API).

• A driver API is a set of functions that the application can call to receive services.

– SQL conformance levels specify which SQL statements, expressions, and data types a driver can process.

Page 16: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-16

Summary ofOBDC Conformance Levels

Page 17: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-17

Summary ofOBDC Conformance Levels

(Continued)

Page 18: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-18

Summary ofSQL Conformance Levels

Page 19: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-19

Summary ofSQL Conformance Levels

(Continued)

Page 20: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-20

ODBC Data Sources

• A data source is an ODBC data structure that identifies a database and the DBMS that processes it.

• Three types of data source names:– A file data source is a file that can be shared among database

users having the same DBMS driver and privilege.– A system data source is local to a single computer and may be

used by the operating system and any user on that system.• System data sources are recommended for Web servers.• To define a system data source name, the type of driver and the

database need to be specified.

– A user data source is available only to the user who created it.

Page 21: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-21

Creating a System Data Source:Selecting the Oracle Driver

Page 22: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-22

Creating a System Data Source:Setting Data Source Properties

Page 23: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-23

David M. Kroenke’s Database Processing

Fundamentals, Design, and Implementation

(10th Edition)

End of Presentation:Chapter Twelve Part One

Page 24: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-24

David M. Kroenke’s

Chapter Twelve:

ODBC, OLE DB, ADO, and ASP

Part Two

Database Processing:Fundamentals, Design, and Implementation

Page 25: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-25

OLE DB

• OLE DB is an implementation of the Microsoft OLE object standard.– OLE DB objects are COM objects and support all required

interfaces for such objects.

• OLE DB breaks the features and functions of a DBMS into COM objects, making it easier for vendors to implement portions of functionality.– This characteristic overcomes a major disadvantage of ODBC.– With ODBC, a vendor must create an ODBC driver for almost all

DBMS features and functions in order to participate in ODBC at all.

Page 26: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-26

Object-Oriented Concepts

• An object-oriented programming object is an abstraction that is defined by its properties and methods.– An abstraction is a generalization of something.– A property specifies set of characteristics of an

object.– A method refers to actions that an object can

perform.– A collection is an object that contains a group of

other objects.

Page 27: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-27

OLE DB Goals

• Create object interfaces for DBMS functionality pieces:– Query, update, transaction management, etc.

• Increase flexibility:– Allow data consumers to use only the objects they need.– Allow data providers to expose pieces of DBMS functionality.– Providers can deliver functionality in multiple interfaces.– Interfaces are standardized and extensible.

• Provide object interfaces over any type of data:– Relational and non-relational database, ODBC or native, VSAM

and other files, Email, etc.

• Do not force data to be converted or moved from where it is.

Page 28: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-28

OLE DB Basic Constructs

• There are data consumers and data providers:– Data consumers - Users of OLE DB functionality.– Data providers - Sources of OLE DB functionality.

• An interface is a set of objects and the properties and methods they expose in that interface:– Objects may expose different properties and methods in different

interfaces.

• An implementation is how an object accomplishes its tasks:– Implementations are hidden from the outside world and may be

changed without impacting the users of the objects.

Page 29: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-29

OLE DB Terminology:Data Providers

• A rowset is equivalent to a cursor.

• OLE DB has two types of data providers: – Tabular data provider — exposes data via rowsets.

• Examples: DBMS, spreadsheets, ISAMs (file processors), email.

– Service provider — a transformer of data through OLE DB interfaces.

• It is both a consumer and a provider of transformed data.• Examples: query processors, XML document creator.

Page 30: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-30

Rowset Interfaces

Page 31: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-31

Active Data Objects (ADO)

• Active Data Objects (ADO) characteristics:– A simple object model for OLE DB data consumers– It can be used from VBScript, JScript, Visual Basic,

Java, C#, C++– It is a single Microsoft data access standard– Data access objects are the same for all types of OLE

DB data

Page 32: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-32

Invoking ADO from Active Server Pages

• In Microsoft’s Active Server Pages (ASP) are Web pages where:– Statements are enclosed within the

characters <% . . .%>.– ASP statements are processed on the Web

server.– Other (HTML) statements are processed by

the client Web browser.

Page 33: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-33

The ADO Object Model

Page 34: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-34

Connection Object

• A connection object establishes a connection to a data provider and data source.– Connections have an isolation mode.

• Once a connection is created, it can be used to create RecordSet and Command objects.

Page 35: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-35

RecordSet Objects

• RecordSet objects represent cursors:– They have both CursorType and LockType properties.– RecordSets can be created with SQL statements.– The Fields collection of a RecordSet can be

processed to individually manipulate fields.– The Errors collection contains one or more error

messages that result from an ADO operation.

Page 36: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-36

Command Object

• The command object is used to execute stored parameterized queries or stored procedures:– Input data can be sent to the correct ASP

using the HTML FORM tag.– Table updates are made using the RecordSet

Update method.

Page 37: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-37

ADO Constants:Isolation Levels

Page 38: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-38

ADO Constants:Cursor Levels

Page 39: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-39

ADO Constants:Lock Types

Page 40: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-40

Connection Object:ASP Code

<%

Dim objConn

Set objConn = Server.CreateObject (“ADODB.connection”)

objConn.IsolationLevel = adXactReadCommitted

‘ use ADOVBS

objConn.Open “ViewRidgeSS”,

%>

<!--#include virtual =“ADOExamples/ADOVBS.inc -->

<%

objConn.Open “DSN=ViewRidgeOracle2;UID=DK1;PWD=Sesame”

%>

http://www.flb.fo/infolit/ADOVBS.INC

Page 41: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-41

RecordSet Object:ASP Code

<%

Dim objRecordSet, varSql

varSQL = “SELECT * FROM ARTIST”

Set objRecordSet = Server.CreateObject(“ADODB.Recordset”)

objRecordSet.CursorTye = adOpenStatic

objRecordSet.LockType = adLockReadOnly

objRecordSet.Open varSQL, objConn

%>

Page 42: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-42

Fields Collection:ASP Code

<%

Dim varI, varNumCols, objField

varNumCols = objRecordSet.Fields.Count

For varI = 0 to varNumCols - 1

Set objField = objRecordSet.Fields(varI)

‘ objField.Name now has the name of the field

‘ objField.Value now has the value of the field

‘ can do something with them here

Next

>%

Page 43: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-43

Errors Collection:ASP Code

<%

Dim varI, varErrorCount, objError

On Error Resume Next

varErrorCount = objConn.Errors.Count

If varErrorCount > 0 Then

For varI = 0 to varErrorCount - 1

Set objError = objConn.Errors(varI)

‘ objError.Description contains

‘ a description of the error

Next

End If

>%

Page 44: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-44

Command Object:ASP Code

<%

Dim objCommand, objParam, objRs

‘Create the Command object, connect it to objConn and set its format

Set objCommand = Server.CreateObject(“ADODB.command”)

Set objCommand.ActiveConnection = objConn

objCommand.CommandText=“{call FindArtist (?)}”

‘Set up the parameter with the necessary value

Set objParam = objCommand.CreateParameter (“Nationality”, adChar, adParamInput, 25)

objCommand.Parameters.Append objParam

objParam.Value = “Spanish”

‘Fire the Stored Proc

Set objRs = objCommand.Execute

>%

Page 45: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-45

ADO Example: Reading a

Table

Artist.asp

Page 46: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-46

ADO Example: Reading a TableThe Artist.asp Results

Page 47: Prentice Hall © 2004 1 COS 346 Day 21. 7-2 Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.

DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall

12-47

David M. Kroenke’s Database Processing

Fundamentals, Design, and Implementation

(10th Edition)

End of Presentation:Chapter Twelve Part Two


Recommended