Web Database Processing

jellytrickInternet και Εφαρμογές Web

10 Νοε 2013 (πριν από 3 χρόνια και 5 μήνες)

63 εμφανίσεις

1

Web Database Processing

Web Database Applications


Static Report Publishing

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


DB Query Publishing

an HTML form is used to submit a query
and the server responds with query results


Application Publishing

Support transaction logic, provide
concurrency control over database changes
etc.

Page 277

Query Example

Transaction Example

ABC web connection tutorial


http://buscom.mcmaster.ca/users/yuanyu
f/Tutorial_asp/homepage.html

For students using facbusad1:

http:/facbusad1.mcmaster.ca/users/ap1/y
uanyuf/Tutorial_asp/homepage.html


Three
-
Tier Architecture

Page 279

Figure 11
-
6

© 2000 Prentice Hall

Functions of Tiers

Page 280

Figure 11
-
7

© 2000 Prentice Hall

Browser


Connect to Web servers through URL


Request and display web pages


Submit data through forms


Perform client site process

Web Server functions


Maintaining session states


Maintaining Server Side Scripting
Environment


Publishing Web pages

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

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

Web hosting

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

ODBC


Open Database Connectivity


DBMS
-
independent means for
processing relational database data


ORACLE


SYBASE


INFORMIX


Microsoft SQL server


IBM DB2

Page 342

Role of ODBC Standard

Page 340

Figure 13
-
2

© 2000 Prentice Hall

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
source

Page 343

ODBC Architecture

Page 343

Figure 13
-
5

© 2000 Prentice Hall

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



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

Role of OLE DB

Page 341

Figure 13
-
3

© 2000 Prentice Hall

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

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

ADO


Active Data Objects;


an interface that enables programmers
in almost any language (including
scripting) to access OLE DB
functionality

Page 351

Role of ADO

Page 342

Figure 13
-
4

© 2000 Prentice Hall

ADO Object Model

Page 352

Figure 13
-
14

© 2000 Prentice Hall

ADO Object Model


Connection object


RecordSet object


Fields Collection


Errors Collection


Command object

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

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>

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

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


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







WYSIWYG Web Database Tool

http://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.

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.


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)