Internet Database Applications

mewstennisΛογισμικό & κατασκευή λογ/κού

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

80 εμφανίσεις

Internet Database Applications

Chapter 28

Marina G. Erechtchoukova

2

Basic Concepts


Internet


a world wide collection of
interconnected computer networks


WWW


a hypermedia
-
based system
that provides a means of browsing
information on the Internet


HTTP


HTML

Marina G. Erechtchoukova

3

Finding Resource in the
Internet


URI:


Protocol


Host computer where a resource is located


The path of the resource on the host
computer


URL


document identifier


URN


persistent, location
-
independent
names

Marina G. Erechtchoukova

4

Three
-
Tier Architecture


Presentation tier


interface


Middle tier


application logic is
implemented as an application written
in a general purpose language


Data Management tier


database
server

Marina G. Erechtchoukova

5

Approaches to Integrating the
Web and DBMSs


Scripting languages


Common Gateway Interface


Extensions to Web server


Java, JDBC, SQLJ,
etc.


Active Server Pages


Oracle Internet Platform





Marina G. Erechtchoukova

6

Common Gateway Interface


Middleware that facilitates server
interaction with application program
that implements a dynamic HTML
document


Dynamic document is created by the
server whenever a browser requests the
document


Provides

general

guidelines

Marina G. Erechtchoukova

7

CGI Script


Scripting language
-

a loose term for any
language that is weakly typed or untyped and
has little or no provision for complex data
structures.


A CGI script is any script designed to accept
and return data that conforms to the CGI
specification.


Languages
:


Conventional

programming

languages


Scripting

languages

Marina G. Erechtchoukova

8

Passing Information to a CGI
Script


Passing environment variables:


Provide control information:


SERVER_NAME


SCRIPT_NAME


REMOTE_ADDR


Send users’ requests and data


Passing data using Standard Input
Stream

Marina G. Erechtchoukova

9

Passing Information to a CGI
Script from HTML Form


Each control element has a name and a value
associated with it


CGI script:


Takes names and appropriate values into
independent pairs


Processes each pair


Method GET


Environment variable
-

Query_String


Method POST


Passing the data using Standard Input Stream
(STDIN)

Marina G. Erechtchoukova

10

Disadvantages of CGI
Database Applications


CGI programs are relatively large:


Needs to connect with a database and close the
connection at the end of the program


No state information is maintained:


The necessity to reconnect again for each query


Server

has

to

generate

a

new

process

or

thread

for

each

CGI

script

execution


A

communication

with

a

database

always

must

go

through

Web

server

Marina G. Erechtchoukova

11

Extending the Web Server


Application Programming Interface:


NSAPI


ISAPI


One copy of application is loaded and
shared between multiple requests to
server.


Load DLLs (similar to CGI scripts) in the
same address space of the HTTP server

Marina G. Erechtchoukova

12

Open Database Connectivity


A standard way to connect and log on to a
DBMS.


Library of ODBC function calls that allow an
application to connect to DBMS, execute SQL
statements, and retrieve results.


A standard representation of data types.


A standard set of error codes.

Marina G. Erechtchoukova

13

ODBC Architecture


ODBC architecture has four
components:


Application

calls ODBC functions


Driver Manager

loads required drivers


Driver

processes ODBC function calls,
submits SQL requests, returns results


Data Source

Marina G. Erechtchoukova

14

JDBC


Provides integration of relational
databases with Java programs


A set of relational database objects and
methods for interacting with SQL data
sources


Part of all Java Virtual Machine
implementations

Marina G. Erechtchoukova

15

SQLJ


SQLJ is static interface for Java. All
statements are checked at compile time


Provides more efficient runtime
execution


In SQLJ SQL statements are visible


SQLJ provides flexible deployment
configurations.

Marina G. Erechtchoukova

16

SQLJ


Embedded SQL for
JAVA

SQLJ


Source

SQLJ Translator

Java


Source

javac

Class


file

JDBC



Database