comp3241 e-business technologies richard henson university of worcester october 2012

31
COMP3241 COMP3241 E-Business E-Business Technologies Technologies Richard Henson Richard Henson University of Worcester University of Worcester October October 2012 2012

Upload: marylou-butler

Post on 27-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

COMP3241COMP3241E-Business TechnologiesE-Business Technologies

Richard HensonRichard Henson

University of WorcesterUniversity of Worcester

OctoberOctober 20122012

Page 2: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Week 3 – Early Web Applications, Week 3 – Early Web Applications, ActiveX, and Database connectivityActiveX, and Database connectivity

Objectives:Objectives:

Contrast between client-end applications and Contrast between client-end applications and client-server applicationsclient-server applications

Explain the architecture of web-based database Explain the architecture of web-based database connection with server-scriptingconnection with server-scripting

Create a presentable shopping page using data Create a presentable shopping page using data from a databasefrom a database

Page 3: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Flatfiles and Databases

Many so-called databases are just lists of data retrieval of data can take a looonnnggg time

Database proper links logically data:hierarchically relationallyobject-oriented

Relational still popular mainly because of SQL

Page 4: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Relational DatabasesRelational Databases

Tight data structure means existing data can be more rapidly located…

Real advantage of a true relational database is that SQL can be used for read/write & query database operations

Page 5: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Linking Server Script code with a relationalrelational database

To make a two-way link with a relational database:need relevant data access components

» components for IIS-based scripts available from Microsoft (MDAC)

“datasets” need to be defined using a programming language & embedded SQL

connectivity link needed to database pathname

Page 6: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Database Design Same principles apply as with any other relational

database management system (RDBMS)… identify entities & attributes produce entity relationship

» define logic relationships between entities make sure data is fully normalised

» create tables & links use embedded SQL statements in the server script to

communicate with the data:» extract data from specific fields in particular tables» put data into specific fields in particular tables

Some “self-taught” developers are unaware of this, and try to build the data round the processing…

Page 7: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Evolution of ApplicationEvolution of Application- RDBMS connectivity- RDBMS connectivity

In the early web development days…In the early web development days… the connection of an application to a particular the connection of an application to a particular

relational database would be hard coded and made relational database would be hard coded and made available as an API (application program interface)available as an API (application program interface)

a client application then had to be written to use a client application then had to be written to use the proprietary API the proprietary API Even then, there was a Even then, there was a problem:problem:

If more than one RDBMS needed to be used?If more than one RDBMS needed to be used? several different APIs would be usedseveral different APIs would be used each needed a client application…each needed a client application… added greatly to the complexity of the task!added greatly to the complexity of the task!

Page 8: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

The Microsoft Solution:The Microsoft Solution:the ODBC APIthe ODBC API

Ideal: the “Universal Data Access” (UDA) modelIdeal: the “Universal Data Access” (UDA) model all data consumers interact with all data providers…all data consumers interact with all data providers… response to the “API for each application” problemresponse to the “API for each application” problem

First stage: ODBC = Open Database ConnectivityFirst stage: ODBC = Open Database Connectivity developed in early 1990s:developed in early 1990s:

» common API for writing applications to access ANY relational common API for writing applications to access ANY relational DBMS for which an ODBC driver had been writtenDBMS for which an ODBC driver had been written

Once the APIs had all been written, tried, and tested…Once the APIs had all been written, tried, and tested…» any relational database with an ODBC compliant interface could use any relational database with an ODBC compliant interface could use

themthem» easy database path connectivity string managementeasy database path connectivity string management

Page 9: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

ActiveXActiveX The next stage in evolution of Microsoft’s data The next stage in evolution of Microsoft’s data

objects modelobjects model sexy name for OLE v2.0sexy name for OLE v2.0 made up of…made up of…

» OLEOLE Object Linking and Embedding…Object Linking and Embedding…

» Combined with COMCombined with COM Common Object ModelCommon Object Model

ActiveX Data Objects make up a series of ActiveX Data Objects make up a series of modular components called ADOmodular components called ADO used for “run-time” web applicationsused for “run-time” web applications basis of .net controlsbasis of .net controls

Page 10: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

What is ActiveXWhat is ActiveX®?? V. successful Microsoft invention…V. successful Microsoft invention… Run-time code became known as a “control” Run-time code became known as a “control”

NO source code so can’t be embedded in HTML, NO source code so can’t be embedded in HTML, but can be called from a HTML filebut can be called from a HTML file

» Runs on any Browser (not interpreted…)Runs on any Browser (not interpreted…) allows compiled (i.e. executable) code to talk to allows compiled (i.e. executable) code to talk to

host applications host applications difficult to “hack” the code if source code not difficult to “hack” the code if source code not

availableavailable

As the scripts are compiled into executable As the scripts are compiled into executable versions the source language is irrelevantversions the source language is irrelevant languages other than VB used…languages other than VB used…

Page 11: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

More about VB ActiveX More about VB ActiveX Data Objects (ADO)Data Objects (ADO)

Use a common, easy-to-use object modelUse a common, easy-to-use object model Designed Designed tto simplify o simplify the the writing writing of of client client

applications to access data sources applications to access data sources through OLE DB providersthrough OLE DB providers more flexible than DSNmore flexible than DSN

» had to be specified on the local machine and limited to had to be specified on the local machine and limited to using the ODBC providers on that machineusing the ODBC providers on that machine

Data sources could now also include:Data sources could now also include: spreadsheetsspreadsheets graphicsgraphics web pages…web pages…

Page 12: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

OLE DBOLE DB Application of OLE/ActiveX principles to Application of OLE/ActiveX principles to

connectivity between applications and connectivity between applications and databasesdatabasesto be more precise, relational database to be more precise, relational database

management systems!management systems! Interface specification that provides a Interface specification that provides a

layer of abstraction between:layer of abstraction between:a data provider e.g. relational DBMSa data provider e.g. relational DBMSa data consumer e.g. business object or a data consumer e.g. business object or

client applicationclient application

Page 13: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Universal Data Access in practiceUniversal Data Access in practice

Page 14: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

System Connection System Connection to the Databaseto the Database

Provided by Microsoft Data Access Components (MDAC) easily downloaded:

» http://www.microsoft.com/en-us/download/details.aspx?id=5793

covers of range of databasesneed most up-to-date version of MDAC (2.8

SP1) to work with latest database versions…

Page 15: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Use of MDAC with “path”

Once the correct components have been chosen…a logical 'connection' can be set up with the

database – wherever it is! If this isn’t correct, scripts on a web server can’t even

link with, let alone interact with, a relational database “Database Path” must include:

a definition of where the database isa few simple rules on how the database should be

treated

Page 16: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Making a connection to a database on the web server

Two systems still used:ODBC – “legacy” .asp scriptingOLE DB – .aspx connectivity

Whichever is used…essential to get connectivity working correctly

» RAD tools like VWD very helpful in achieving this…

Once connectivity achieved, server-script can use embedded SQL commands to link to and communicate smoothly with database tablesagain… RAD tool like VWD can save a lot of time…

Page 17: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Databases & web pages

Some early e-commerce applications used embedded JavaScript and a small local database

Problems:database took a long while to download &

could be tampered with!if database ran locally how could data be

updated… prices changed, new products added?

Page 18: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Early online shopping Early online shopping example : Shop@ssistantexample : Shop@ssistant

Came out of the early “wow, Java” revolution in Came out of the early “wow, Java” revolution in web developmentweb developmenthttp://staffweb.worc.ac.uk/hensonr/shop@ssistant

Whole system (30kb) written in Java Script, runs Whole system (30kb) written in Java Script, runs on the client machine (!)on the client machine (!) stores & presents product datastores & presents product data shows all the components and functionality expected shows all the components and functionality expected

of a shopping cart systemof a shopping cart system interfaces with merchant systems that can be used to interfaces with merchant systems that can be used to

handle online paymenthandle online payment TAKE A LOOK!!! Or download and run it yourselfTAKE A LOOK!!! Or download and run it yourself

Page 19: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Critical Look at Critical Look at Client-end “apps”Client-end “apps”

Absolutely fantastic!Absolutely fantastic! Even better on a mobile…Even better on a mobile… BUT usually for entertainment only…BUT usually for entertainment only…

only small data sources, or infrequently only small data sources, or infrequently changed data sources are usedchanged data sources are used

usually “single user”usually “single user”

Page 20: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Whatever happened to Whatever happened to “client only” web shopping? “client only” web shopping?

In an ideal (Internet) world everything would be In an ideal (Internet) world everything would be able to run via the browser on the client able to run via the browser on the client machine. Result:machine. Result: fasterfaster all data localall data local more controlledmore controlled

The “Java+client-end HTML” model is fine…The “Java+client-end HTML” model is fine… until you need to store and change data… securely!!until you need to store and change data… securely!!

Page 21: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Applications requiring Applications requiring multi-client use & shared data multi-client use & shared data Specific requirement:Specific requirement:

Large, regularly updated centralised data store that Large, regularly updated centralised data store that needs to be accessed by a number of clientsneeds to be accessed by a number of clients

Requirements for client-end solutionRequirements for client-end solution??» database updated centrallydatabase updated centrally» database downloaded every time the application is to be used!database downloaded every time the application is to be used!

Feasibility of client-end solution?Feasibility of client-end solution?» not powerful enough?not powerful enough?» client not enough storage capacity?client not enough storage capacity?» not sufficient bandwidth?not sufficient bandwidth?» downloading databases can compromise securitydownloading databases can compromise security

Page 22: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Using a remote database Using a remote database with a web pagewith a web page

Compelling reason for client-server web applications…data held in a secure placeproduct data easily updateddatabase processing can happen at a

powerful server

Page 23: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Demands of Applications based Demands of Applications based on centralised data storage!on centralised data storage!

Typically… the database is :Typically… the database is :securesecurereadily accessible from all clientsreadily accessible from all clientsqueried remotelyqueried remotelyalterable only by specific personsalterable only by specific persons

Only achievable through a Only achievable through a client-server modelclient-server model

Page 24: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

How Server Scripts can How Server Scripts can Interact with DatabasesInteract with Databases

Contain embedded SQL code that can extract data from or send data to a database

Page 25: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

How Server Scripts can How Server Scripts can Interact with DatabasesInteract with Databases

Whenever a database is updated…

» updated data picked up by server-script when it runs

» updated data displayed on client

Page 26: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

How Server Scripts can How Server Scripts can Interact with DatabasesInteract with Databases

Whenever a browser form captures data…

» data transferred directly to relevant server

» then stored in specified database field(s)

Page 27: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

How Server Scripts How Server Scripts Interact with DatabasesInteract with Databases

Whenever database information needs to be presented:database fields and

records taken into server memory

data sent to local machine to be displayed within a HTML format

Page 28: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Parameter Passing Parameter Passing between Programsbetween Programs

Essential to programming Coding can rapidly get quite complex… Essential for

product selectionpassing data into a remote SQL querysound horrendous?

» you’ll be eased into this gently…» Starting NEXT week.

Page 29: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Mechanism for variable passing Mechanism for variable passing between Dynamic Web Pagesbetween Dynamic Web Pages

HTML “GET” function:parameter/s tagged on to the URL e.g.

» Get <www address>/thetest.jsp?firstname=richard&password=holidays&lastname=henson&action=transferbankfunds

Can result in v. long URLs…

Page 30: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

Variable Passing between Variable Passing between Dynamic Web PagesDynamic Web Pages

Alternative: “POST” designed to be used within HTML forms…

Example of syntax, added to HTML coding within <FORM>…post /thetest.jsp

firstname=richard&password=holidays&lastname=henson&action=transferbankfunds

Page 31: COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012

And now for the practical…Thanks for listening!

http://csharpdotnetfreak.blogspot.com/2009/05/aspnet-creating-shopping-cart-example.html