41
1 Web Database Processing

1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Embed Size (px)

Citation preview

Page 1: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

1

Web Database Processing

Page 2: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Web Database Applications Static Report Publishing

a report is prepared from a database application and exported to HTML

DB Query Publishingan HTML form is used to submit a query and the server responds with query results

Application PublishingSupport transaction logic, provide concurrency control over database changes etc.

Page 277

Page 3: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Query Example

Page 4: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Transaction Example

Page 5: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

ABC web connection tutorial

http://buscom.mcmaster.ca/users/yuanyuf/Tutorial_asp/homepage.html

For students using facbusad1:http:/facbusad1.mcmaster.ca/users/

ap1/yuanyuf/Tutorial_asp/homepage.html

Page 6: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Three-Tier Architecture

Page 279Figure 11-6 © 2000 Prentice Hall

Page 7: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Functions of Tiers

Page 280Figure 11-7 © 2000 Prentice Hall

Page 8: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Browser Connect to Web servers through

URL Request and display web pages Submit data through forms Perform client site process

Page 9: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Web Server functions Maintaining session states Maintaining Server Side Scripting

Environment Publishing Web pages

Page 10: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Maintaining Session States HTTP is a stateless protocol When database is used for transaction process,

the Web server needs to maintain the identity of the client

http://aserver/anapplication/default.asp ASP creates two objects:

Application object references an application Session object references a client

The properties of application and session objects can be referenced by script in ASP page

Page 11: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Maintaining Server Side Scripting Environment Communication with DB server Data caching Constraint enforcement View construction (XML or other) Security and control Application logic View materialization

Page 12: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Web hosting

Page 13: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB
Page 14: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Web browser vs. web server Personal web server allows other

people view your web page if your computer is connected to internet with an IP number.

You can copy any web page to your hard disk and view it using web browser without the need of local web server

Page 15: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

ODBC Open Database Connectivity DBMS-independent means for

processing relational database data ORACLE SYBASE INFORMIX Microsoft SQL server IBM DB2

Page 342

Page 16: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Role of ODBC Standard

Page 340Figure 13-2 © 2000 Prentice Hall

Page 17: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

ODBC Terminology Data source: the database, its

associated DBMS, operating system, and network platform

Driver manager: intermediary between the application and DBMS drivers

Driver: processes ODBC requests and submits SQL statements to a data sourcePage 343

Page 18: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

ODBC Architecture

Page 343Figure 13-5 © 2000 Prentice Hall

Page 19: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Conformance Levels ODBC conformance level

concerned through driver’s application program interface (API) Core, level 1, level 2

SQL conformance level Minimum SQL Grammar Core SQL Grammar Extended SQL Grammar

Page 344

Page 20: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB
Page 21: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB
Page 22: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

ODBC Data Source Name A data source is a ODBC data structure

that identifies a database and the DBMS that processes it.

File data source: a file shared among database users

System data source: local to a single computer

User data source: only available to the user who created it

Page 346

Page 23: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Role of OLE DB

Page 341Figure 13-3 © 2000 Prentice Hall

Page 24: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

OLE DB Object Linking and Embedding Database; OLE DB breaks the features and functions

of a DBMS up into objects Provides an object-oriented interface to

data of almost any type and used as an interface to ODBC and non-relational data

With OLE DB, a DBMS vendor can implement portions of their product

Page 348

Page 25: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Object Terminology Abstraction: a generalization of something,

e.g. rowset is abstraction of recordset Method: actions that an object can perform,

e.g. Open, MoveFirst, Move Next, Close Property: a characteristic of an object, e.g.

AllowEdit, RecordsetType of a recordset Collection: object that contains a group of

other objects, e.g. a recordset is a collection of field objects

Recordset.Fields.Count is a number of fields of a recordset

Page 348

Page 26: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

ADO Active Data Objects; an interface that enables

programmers in almost any language (including scripting) to access OLE DB functionality

Page 351

Page 27: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Role of ADO

Page 342 Figure 13-4 © 2000 Prentice Hall

Page 28: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

ADO Object Model

Page 352Figure 13-14 © 2000 Prentice Hall

Page 29: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

ADO Object Model Connection object RecordSet object Fields Collection Errors Collection Command object

Page 30: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Web-to-Database Connection with Active Server Pages (ASP) A scripting environment that you can use

to create and run dynamic, interactive Web server applications

The Web Server find the file and then processes all the ASP code between <% ... %> before handing back the page.

Allows for easy querying and updating of a database from a Web page

http://www.learnasp.com http://www.asp101.com/samples/index.asp

Page 31: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

A Simple Example of ASP<html><head> <TITLE>hi.asp</TITLE> </head> <body bgcolor="#FFFFFF"> Today is <%=now%> and all is well<br> <%if hour(now())<12 THEN%> Good Morning <%ELSE%> Good Day! <%END IF%> </body></html>

Page 32: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Use ASP to access database Create a data base on the server Create DSN (Data Source Name) using

ODBC (Open Data Base Connectivity) In a HTML form, use action to invoke an

ASP page In ASP page, connect to the database

through DSN, using the values from the form to make a SQL query

Execute SQL and generate a result HTML page

Page 33: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

http://www.asp101.com/samples/index.asp

Page 34: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

http://www.asp101.com/samples/index.asp

Page 35: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB
Page 36: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB
Page 37: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB
Page 38: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB
Page 39: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

WYSIWYG Web Database Toolhttp://builder.cnet.com/webbuilding/pages/Authoring/WebDB/?tag=st.bl.3880.pro_h.bl_WebDB

The shift from code-based approach to tools with graphical interfaces.

All of the top-end WYSIWYG HTML editors have added database connectivity to some degree.

Page 40: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

Macromedia Dreamweaver MX

a professional HTML editor for designing, coding, and developing websites, web pages, and web applications.

Dreamweaver helps you to build dynamic database-backed web applications using server languages such as ASP, ASP.NET, ColdFusion Markup Language (CFML), JSP, and PHP.

Page 41: 1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB

ASP vs. PHP ASP (Active Sever Pages) is a Microsoft

product, and is usually used in conjunction with the IIS (Internet Information Server) that runs on Microsoft services. Uses Microsoft Visual Basic.

PHP (Hypertext Pre Processor) is a open source program that runs on UNIX and Linux servers. Uses C++ and MySQL (free)