SlideShare une entreprise Scribd logo
1  sur  35
Dynamic Web Applications
With Databases
Adapted from Database Management course
offered by Ray Larson, UC Berkeley
Overview
• Why use a database system for Web
design and e-commerce?
• What systems are available?
• Pros and Cons of different web database
systems?
Why Use a Database System?
• Simple Web sites with only a few pages
don’t need much more than static HTML
files
Simple Web Applications
Server
Web
Server
Internet
Files
Clients
Adding Dynamic Content to the Site
• Small sites can often use simple HTML
and CGI scripts accessing data files to
create dynamic content for small sites.
Dynamic Web Applications 1
Server
CGI
Web
Server
Internet
Files
Clients
Issues For Scaling Up Web Applications
• Performance
• Scalability
• Maintenance
• Data Integrity
• Transaction support
Performance Issues
• Problems arise as both the data to be
managed and usage of the site grows.
– Interpreted CGI scripts are inherently slower
than compiled native programs
– Starting CGI applications takes time for each
connection
– Load on the system compounds the problem
– Tied to other scalability issues
Scalability Issues
• Well-designed database systems will
permit the applications to scale to
accommodate very large databases
– A script that works fine scanning a small data
file may become unusable when the file
becomes large.
– Issues of transaction workload on the site
• Starting a separate copy of a CGI program for
each user is NOT a scalable solution as the
workload grows
Maintenance Issues
• Dealing with multiple data files (customer list,
product list, customer orders, etc.) using CGI
means:
– If any data element in one of the files changes, all
scripts that access that file must be rewritten
– If files are linked, the programs must insure that data
in all the files remains synchronized
– A large part of maintenance will involve dealing with
data integrity issues
– Unanticipated requirements may require rewriting
scripts
Data Integrity Constraint Issues
• These are constraints we wish to impose
in order to protect the database from
becoming inconsistent.
• Five basic types
– Required data
– attribute domain constraints
– entity integrity
– referential integrity
– enterprise constraints
Transaction support
• Concurrency control (ensuring the validity
of database updates in a shared multiuser
environment).
Transaction Processing
• Transactions should be ACID:
– Atomic – Results of transaction are either all
committed or all rolled back
– Consistent – Data is transformed from one
consistent state to another
– Isolated – The results of a transaction are
invisible to other transactions
– Durable – Once committed the results of a
transaction are permanent and survive
system or media failures
Why Use a Database System?
• Database systems have concentrated on
providing solutions for all of these issues
for scaling up Web applications
– Performance
– Scalability
– Maintenance
– Data Integrity
– Transaction support
• While systems differ in their support, most
offer some support for all of these.
Dynamic Web Applications 2
Server
database
CGI
DBMS
Web
Server
Internet
Files
Clients
database
database
What Database systems are available?
• Choices depend on:
– Size (current and projected) of the application
– Hardware and OS Platforms to be used in the
application
– Features required
• E.g.: SQL? Upgrade path? Full-text indexing? Attribute size
limitations? Locking protocols? Direct Web Server access?
Security?
– Staff support for DBA, etc.
– Programming support (or lack thereof)
– Cost/complexity of administration
– Budget
Desktop Database Systems
• Individuals or very small enterprises can create
DBMS-enabled Web applications relatively
inexpensively
• Some systems will require an application server
(such as ColdFusion) to provide the access path
between the Web server and the DBMS
System (producer) Platform SQL ODBC Scaling
Access (Microsoft) Windows Yes Yes SQL Server
FoxPro (Microsoft) Windows, Mac Yes Yes SQL Server
FileMaker (FileMaker) Windows, Mac No No FileMaker Server
Excel (Microsoft) Windows, Mac No Yes Convert to Access
Files (owner) Windows, Mac No No Import into DB
Pros and Cons of Database Options
• Desktop databases
– usually simple to set up and administer
– inexpensive
– often will not scale to a very large number of
users or very large database size
– May lack locking management appropriate for
multiuser access
– Poor handling for full-text search
– Well supported by application software
(Coldfusion, PHP, etc.)
Enterprise Database Systems
• Enterprise servers are powerful and
available in many different configurations
• They also tend to be VERY expensive
• Pricing is usually based on users, or
CPU’s
System Platform SQL ODBC JDBC Web?
SQL-Server (Microsoft) WIndowsNT -2000 Yes Yes ? Yes (IIS)
Oracle Internet Platform Unix, Linux, NT Yes Yes Yes Yes
Informix Internet Foundation.2000 Unix, Linux, NT Yes Yes Yes Yes
Sybase Adaptive Server Unix, Linux, NT Yes Yes Yes Yes
DB2 (IBM) IBM,Unix, Linux, NT Yes Yes Yes Yes?
Pros and Cons of Database Options
• Enterprise databases
– Can be very complex to set up and administer
• Oracle, for example recommends RAID-1 with 7x2 disk
configuration as a bare minimum, more recommended
– Expensive
– Will scale to a very large number of users
– Will scale to very large databases
– Incorporate good transaction control and lock
management
– Native handling of Text search is poor, but most
DBMS have add-on text search options
– Support for applications software (ColdFusion, PHP,
etc.)
Free Database Servers
• System is free, but there is also no help line.
• Include many of the features of Enterprise systems,
but tend to be lighter weight
• Versions may vary in support for different systems
• Open Source -- So programmers can add features
System Platform SQL ODBC JDBC Web?
mSQL Unix, Linux Yes Yes No(?) No?
MySQL Unix, Linux, NT Yes Yes No(?) No?
PostgreSQL Unix, Linux, NT Yes Yes Yes No?
Pros and Cons of Database Options
• Free databases
– Can be complex to set up and administer
– Inexpensive (FREE!)
– usually will scale to a large number of users
– Incorporate good transaction control and lock
management
– Native handling of Text search is poor
– Support for applications software (ColdFusion,
PHP, etc.)
Embedded Database Servers
• May require programming experience to
install
• Tend to be fast and economical in space
requirements
System Platform SQL ODBCJDBC Web?
Sleepycat DB Unix, Linux, Win No No Java API No?
Solid Unix, Linux, Win Yes Yes Yes Yes
Pros and Cons of Database Options
• Embedded databases
– Must be embedded in a program
– Can be incorporated in a scripting language
– inexpensive (for non-commercial application)
– May not scale to a very large number of users
(depends on how it is used)
– Incorporate good transaction control and lock
management
– Text search support is minimal
– May not support SQL
Database Security
• Different systems vary in security support:
– Views or restricted subschemas
– Authorization rules to identify users and the
actions they can perform
– User-defined procedures (and rule systems)
to define additional constraints or limitations in
using the database
– Encryption to encode sensitive data
– Authentication schemes to positively identify a
person attempting to gain access to the
database
Views
• A subset of the database presented to
some set of users.
– SQL: CREATE VIEW viewname AS SELECT
field1, field2, field3,…, FROM table1, table2
WHERE <where clause>;
– Note: “queries” in Access function as views.
Authorization Rules
• Most current DBMS permit the DBA to
define “access permissions” on a table by
table basis (at least) using the GRANT
and REVOKE SQL commands.
• Some systems permit finer grained
authorization (most use GRANT and
REVOKE on variant views.
• Some desktop systems have poor
authorization support.
Database Backup and Recovery
• Backup
• Journaling (audit trail)
• Checkpoint facility
• Recovery manager
Web Application Server Software
• PHP
• ASP
• All of the are server-side scripting
languages that embed code in HTML
pages
PHP
• PHP is an Open Source Software project
with many programmers working on the
code.
– Commonly paired with MySQL, another OSS
project
– Free
– Both Windows and Unix support
• Estimated that more than 250,000 web
sites use PHP as an Apache Module.
PHP Syntax
• Similar to ASP
• Includes most programming structures (Loops,
functions, Arrays, etc.)
• Loads HTML form variables so that they are
addressable by name
<HTML><BODY>
<?php
$myvar = “Hello World”;
echo $myvar ;
?>
</BODY></HTML>
Combined with MySQL
• DBMS interface appears as a set of
functions:
<HTML><BODY>
<?php
$db = mysql_connect(“localhost”, “root”);
mysql_select_db(“mydb”,$db);
$result = mysql_query(“SELECT * FROM employees”, $db);
Printf(“First Name: %s <br>n”, mysql_result($result, 0 “first”);
Printf(“Last Name: %s <br>n”, mysql_result($result, 0 “last”);
?></BODY></HTML>
ASP – Active Server Pages
• Another server-side scripting language
• From Microsoft using Visual Basic as the
Language model (VBScript), though
Javascript (actually MS Jscript) is also
supported
• Works with Microsoft IIS and gives access
to ODBC databases
ASP Syntax
<%
SQL="SELECT last, first FROM employees
ORDER BY last"
set conn = server.createobject("ADODB.Connection")
conn.open “employee"
set people=conn.execute(SQL)
%>
<% do while not people.eof
set resultline=people(0) & “, “ & people(1) & “<BR>”
Response.Write(resultline)
people.movenext
loop%>
<% people.close %>
Conclusions
• Database technology is a required
component for large-scale dynamic Web
sites, especially E-Commerce sites
• Web databases cover most of the needs
of dynamic sites (except for text search)
• Many solutions and systems are available
for web-enabled databases

Contenu connexe

Tendances

Deployment Methodology
Deployment MethodologyDeployment Methodology
Deployment Methodology
David Messineo
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
Jin Castor
 

Tendances (20)

Deployment Methodology
Deployment MethodologyDeployment Methodology
Deployment Methodology
 
Polymorphism in C# Function overloading in C#
Polymorphism in C# Function overloading in C#Polymorphism in C# Function overloading in C#
Polymorphism in C# Function overloading in C#
 
Web Development with HTML5, CSS3 & JavaScript
Web Development with HTML5, CSS3 & JavaScriptWeb Development with HTML5, CSS3 & JavaScript
Web Development with HTML5, CSS3 & JavaScript
 
Introduction to Apex for Developers
Introduction to Apex for DevelopersIntroduction to Apex for Developers
Introduction to Apex for Developers
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Test cases
Test casesTest cases
Test cases
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
C# program structure
C# program structureC# program structure
C# program structure
 
Unit 07: Design Patterns and Frameworks (1/3)
Unit 07: Design Patterns and Frameworks (1/3)Unit 07: Design Patterns and Frameworks (1/3)
Unit 07: Design Patterns and Frameworks (1/3)
 
Java Beans
Java BeansJava Beans
Java Beans
 
TestNG Framework
TestNG Framework TestNG Framework
TestNG Framework
 
Software Testing Tutorial For Beginners | Manual & Automation Testing | Selen...
Software Testing Tutorial For Beginners | Manual & Automation Testing | Selen...Software Testing Tutorial For Beginners | Manual & Automation Testing | Selen...
Software Testing Tutorial For Beginners | Manual & Automation Testing | Selen...
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
 
Xpath in Selenium | Selenium Xpath Tutorial | Selenium Xpath Examples | Selen...
Xpath in Selenium | Selenium Xpath Tutorial | Selenium Xpath Examples | Selen...Xpath in Selenium | Selenium Xpath Tutorial | Selenium Xpath Examples | Selen...
Xpath in Selenium | Selenium Xpath Tutorial | Selenium Xpath Examples | Selen...
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developers
 
Static and Dynamic webpage
Static and Dynamic webpageStatic and Dynamic webpage
Static and Dynamic webpage
 
BlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance ReportingBlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance Reporting
 
Strings in Java
Strings in JavaStrings in Java
Strings in Java
 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT
 
Python made easy
Python made easy Python made easy
Python made easy
 

En vedette

Data Processing and Semantics for Advanced Internet of Things (IoT) Applicati...
Data Processing and Semantics for Advanced Internet of Things (IoT) Applicati...Data Processing and Semantics for Advanced Internet of Things (IoT) Applicati...
Data Processing and Semantics for Advanced Internet of Things (IoT) Applicati...
Artificial Intelligence Institute at UofSC
 
Smart Data - How you and I will exploit Big Data for personalized digital hea...
Smart Data - How you and I will exploit Big Data for personalized digital hea...Smart Data - How you and I will exploit Big Data for personalized digital hea...
Smart Data - How you and I will exploit Big Data for personalized digital hea...
Amit Sheth
 

En vedette (6)

Data Processing and Semantics for Advanced Internet of Things (IoT) Applicati...
Data Processing and Semantics for Advanced Internet of Things (IoT) Applicati...Data Processing and Semantics for Advanced Internet of Things (IoT) Applicati...
Data Processing and Semantics for Advanced Internet of Things (IoT) Applicati...
 
What's up at Kno.e.sis?
What's up at Kno.e.sis? What's up at Kno.e.sis?
What's up at Kno.e.sis?
 
Smart Data - How you and I will exploit Big Data for personalized digital hea...
Smart Data - How you and I will exploit Big Data for personalized digital hea...Smart Data - How you and I will exploit Big Data for personalized digital hea...
Smart Data - How you and I will exploit Big Data for personalized digital hea...
 
Web and Complex Systems Lab @ Kno.e.sis
Web and Complex Systems Lab @ Kno.e.sisWeb and Complex Systems Lab @ Kno.e.sis
Web and Complex Systems Lab @ Kno.e.sis
 
Trust Management: A Tutorial
Trust Management: A TutorialTrust Management: A Tutorial
Trust Management: A Tutorial
 
2015 Kno.e.sis Center Annual Review
2015 Kno.e.sis Center Annual Review2015 Kno.e.sis Center Annual Review
2015 Kno.e.sis Center Annual Review
 

Similaire à Lecture 9: Dynamic web application

Kb 40 kevin_klineukug_reading20070717[1]
Kb 40 kevin_klineukug_reading20070717[1]Kb 40 kevin_klineukug_reading20070717[1]
Kb 40 kevin_klineukug_reading20070717[1]
shuwutong
 
Membase Meetup - Silicon Valley
Membase Meetup - Silicon ValleyMembase Meetup - Silicon Valley
Membase Meetup - Silicon Valley
Membase
 
Storage Systems For Scalable systems
Storage Systems For Scalable systemsStorage Systems For Scalable systems
Storage Systems For Scalable systems
elliando dias
 
Handling Massive Writes
Handling Massive WritesHandling Massive Writes
Handling Massive Writes
Liran Zelkha
 

Similaire à Lecture 9: Dynamic web application (20)

Kb 40 kevin_klineukug_reading20070717[1]
Kb 40 kevin_klineukug_reading20070717[1]Kb 40 kevin_klineukug_reading20070717[1]
Kb 40 kevin_klineukug_reading20070717[1]
 
ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa...
ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa...ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa...
ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa...
 
Database Administration & Management - 01
Database Administration & Management - 01Database Administration & Management - 01
Database Administration & Management - 01
 
DBAM-01.pdf
DBAM-01.pdfDBAM-01.pdf
DBAM-01.pdf
 
Database nel cloud: una alternativa ai fogli di calcolo per raccogliere, gest...
Database nel cloud: una alternativa ai fogli di calcolo per raccogliere, gest...Database nel cloud: una alternativa ai fogli di calcolo per raccogliere, gest...
Database nel cloud: una alternativa ai fogli di calcolo per raccogliere, gest...
 
SQL_DBA USA_M&T Bank
SQL_DBA USA_M&T BankSQL_DBA USA_M&T Bank
SQL_DBA USA_M&T Bank
 
Hpc lunch and learn
Hpc lunch and learnHpc lunch and learn
Hpc lunch and learn
 
Enterprise Data Integration for Microsoft Dynamics CRM
Enterprise Data Integration for Microsoft Dynamics CRMEnterprise Data Integration for Microsoft Dynamics CRM
Enterprise Data Integration for Microsoft Dynamics CRM
 
Architecture Patterns - Open Discussion
Architecture Patterns - Open DiscussionArchitecture Patterns - Open Discussion
Architecture Patterns - Open Discussion
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databases
 
Membase Meetup - Silicon Valley
Membase Meetup - Silicon ValleyMembase Meetup - Silicon Valley
Membase Meetup - Silicon Valley
 
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
 
Should I move my database to the cloud?
Should I move my database to the cloud?Should I move my database to the cloud?
Should I move my database to the cloud?
 
Apache Hadoop Hive
Apache Hadoop HiveApache Hadoop Hive
Apache Hadoop Hive
 
Storage Systems For Scalable systems
Storage Systems For Scalable systemsStorage Systems For Scalable systems
Storage Systems For Scalable systems
 
(ISM303) Migrating Your Enterprise Data Warehouse To Amazon Redshift
(ISM303) Migrating Your Enterprise Data Warehouse To Amazon Redshift(ISM303) Migrating Your Enterprise Data Warehouse To Amazon Redshift
(ISM303) Migrating Your Enterprise Data Warehouse To Amazon Redshift
 
Pascal benois performance_troubleshooting-spsbe18
Pascal benois performance_troubleshooting-spsbe18Pascal benois performance_troubleshooting-spsbe18
Pascal benois performance_troubleshooting-spsbe18
 
Introduction to Azure SQL DB
Introduction to Azure SQL DBIntroduction to Azure SQL DB
Introduction to Azure SQL DB
 
L19 Application Architecture
L19 Application ArchitectureL19 Application Architecture
L19 Application Architecture
 
Handling Massive Writes
Handling Massive WritesHandling Massive Writes
Handling Massive Writes
 

Dernier

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Lecture 9: Dynamic web application

  • 1. Dynamic Web Applications With Databases Adapted from Database Management course offered by Ray Larson, UC Berkeley
  • 2. Overview • Why use a database system for Web design and e-commerce? • What systems are available? • Pros and Cons of different web database systems?
  • 3. Why Use a Database System? • Simple Web sites with only a few pages don’t need much more than static HTML files
  • 5. Adding Dynamic Content to the Site • Small sites can often use simple HTML and CGI scripts accessing data files to create dynamic content for small sites.
  • 6. Dynamic Web Applications 1 Server CGI Web Server Internet Files Clients
  • 7. Issues For Scaling Up Web Applications • Performance • Scalability • Maintenance • Data Integrity • Transaction support
  • 8. Performance Issues • Problems arise as both the data to be managed and usage of the site grows. – Interpreted CGI scripts are inherently slower than compiled native programs – Starting CGI applications takes time for each connection – Load on the system compounds the problem – Tied to other scalability issues
  • 9. Scalability Issues • Well-designed database systems will permit the applications to scale to accommodate very large databases – A script that works fine scanning a small data file may become unusable when the file becomes large. – Issues of transaction workload on the site • Starting a separate copy of a CGI program for each user is NOT a scalable solution as the workload grows
  • 10. Maintenance Issues • Dealing with multiple data files (customer list, product list, customer orders, etc.) using CGI means: – If any data element in one of the files changes, all scripts that access that file must be rewritten – If files are linked, the programs must insure that data in all the files remains synchronized – A large part of maintenance will involve dealing with data integrity issues – Unanticipated requirements may require rewriting scripts
  • 11. Data Integrity Constraint Issues • These are constraints we wish to impose in order to protect the database from becoming inconsistent. • Five basic types – Required data – attribute domain constraints – entity integrity – referential integrity – enterprise constraints
  • 12. Transaction support • Concurrency control (ensuring the validity of database updates in a shared multiuser environment).
  • 13. Transaction Processing • Transactions should be ACID: – Atomic – Results of transaction are either all committed or all rolled back – Consistent – Data is transformed from one consistent state to another – Isolated – The results of a transaction are invisible to other transactions – Durable – Once committed the results of a transaction are permanent and survive system or media failures
  • 14. Why Use a Database System? • Database systems have concentrated on providing solutions for all of these issues for scaling up Web applications – Performance – Scalability – Maintenance – Data Integrity – Transaction support • While systems differ in their support, most offer some support for all of these.
  • 15. Dynamic Web Applications 2 Server database CGI DBMS Web Server Internet Files Clients database database
  • 16. What Database systems are available? • Choices depend on: – Size (current and projected) of the application – Hardware and OS Platforms to be used in the application – Features required • E.g.: SQL? Upgrade path? Full-text indexing? Attribute size limitations? Locking protocols? Direct Web Server access? Security? – Staff support for DBA, etc. – Programming support (or lack thereof) – Cost/complexity of administration – Budget
  • 17. Desktop Database Systems • Individuals or very small enterprises can create DBMS-enabled Web applications relatively inexpensively • Some systems will require an application server (such as ColdFusion) to provide the access path between the Web server and the DBMS System (producer) Platform SQL ODBC Scaling Access (Microsoft) Windows Yes Yes SQL Server FoxPro (Microsoft) Windows, Mac Yes Yes SQL Server FileMaker (FileMaker) Windows, Mac No No FileMaker Server Excel (Microsoft) Windows, Mac No Yes Convert to Access Files (owner) Windows, Mac No No Import into DB
  • 18. Pros and Cons of Database Options • Desktop databases – usually simple to set up and administer – inexpensive – often will not scale to a very large number of users or very large database size – May lack locking management appropriate for multiuser access – Poor handling for full-text search – Well supported by application software (Coldfusion, PHP, etc.)
  • 19. Enterprise Database Systems • Enterprise servers are powerful and available in many different configurations • They also tend to be VERY expensive • Pricing is usually based on users, or CPU’s System Platform SQL ODBC JDBC Web? SQL-Server (Microsoft) WIndowsNT -2000 Yes Yes ? Yes (IIS) Oracle Internet Platform Unix, Linux, NT Yes Yes Yes Yes Informix Internet Foundation.2000 Unix, Linux, NT Yes Yes Yes Yes Sybase Adaptive Server Unix, Linux, NT Yes Yes Yes Yes DB2 (IBM) IBM,Unix, Linux, NT Yes Yes Yes Yes?
  • 20. Pros and Cons of Database Options • Enterprise databases – Can be very complex to set up and administer • Oracle, for example recommends RAID-1 with 7x2 disk configuration as a bare minimum, more recommended – Expensive – Will scale to a very large number of users – Will scale to very large databases – Incorporate good transaction control and lock management – Native handling of Text search is poor, but most DBMS have add-on text search options – Support for applications software (ColdFusion, PHP, etc.)
  • 21. Free Database Servers • System is free, but there is also no help line. • Include many of the features of Enterprise systems, but tend to be lighter weight • Versions may vary in support for different systems • Open Source -- So programmers can add features System Platform SQL ODBC JDBC Web? mSQL Unix, Linux Yes Yes No(?) No? MySQL Unix, Linux, NT Yes Yes No(?) No? PostgreSQL Unix, Linux, NT Yes Yes Yes No?
  • 22. Pros and Cons of Database Options • Free databases – Can be complex to set up and administer – Inexpensive (FREE!) – usually will scale to a large number of users – Incorporate good transaction control and lock management – Native handling of Text search is poor – Support for applications software (ColdFusion, PHP, etc.)
  • 23. Embedded Database Servers • May require programming experience to install • Tend to be fast and economical in space requirements System Platform SQL ODBCJDBC Web? Sleepycat DB Unix, Linux, Win No No Java API No? Solid Unix, Linux, Win Yes Yes Yes Yes
  • 24. Pros and Cons of Database Options • Embedded databases – Must be embedded in a program – Can be incorporated in a scripting language – inexpensive (for non-commercial application) – May not scale to a very large number of users (depends on how it is used) – Incorporate good transaction control and lock management – Text search support is minimal – May not support SQL
  • 25. Database Security • Different systems vary in security support: – Views or restricted subschemas – Authorization rules to identify users and the actions they can perform – User-defined procedures (and rule systems) to define additional constraints or limitations in using the database – Encryption to encode sensitive data – Authentication schemes to positively identify a person attempting to gain access to the database
  • 26. Views • A subset of the database presented to some set of users. – SQL: CREATE VIEW viewname AS SELECT field1, field2, field3,…, FROM table1, table2 WHERE <where clause>; – Note: “queries” in Access function as views.
  • 27. Authorization Rules • Most current DBMS permit the DBA to define “access permissions” on a table by table basis (at least) using the GRANT and REVOKE SQL commands. • Some systems permit finer grained authorization (most use GRANT and REVOKE on variant views. • Some desktop systems have poor authorization support.
  • 28. Database Backup and Recovery • Backup • Journaling (audit trail) • Checkpoint facility • Recovery manager
  • 29. Web Application Server Software • PHP • ASP • All of the are server-side scripting languages that embed code in HTML pages
  • 30. PHP • PHP is an Open Source Software project with many programmers working on the code. – Commonly paired with MySQL, another OSS project – Free – Both Windows and Unix support • Estimated that more than 250,000 web sites use PHP as an Apache Module.
  • 31. PHP Syntax • Similar to ASP • Includes most programming structures (Loops, functions, Arrays, etc.) • Loads HTML form variables so that they are addressable by name <HTML><BODY> <?php $myvar = “Hello World”; echo $myvar ; ?> </BODY></HTML>
  • 32. Combined with MySQL • DBMS interface appears as a set of functions: <HTML><BODY> <?php $db = mysql_connect(“localhost”, “root”); mysql_select_db(“mydb”,$db); $result = mysql_query(“SELECT * FROM employees”, $db); Printf(“First Name: %s <br>n”, mysql_result($result, 0 “first”); Printf(“Last Name: %s <br>n”, mysql_result($result, 0 “last”); ?></BODY></HTML>
  • 33. ASP – Active Server Pages • Another server-side scripting language • From Microsoft using Visual Basic as the Language model (VBScript), though Javascript (actually MS Jscript) is also supported • Works with Microsoft IIS and gives access to ODBC databases
  • 34. ASP Syntax <% SQL="SELECT last, first FROM employees ORDER BY last" set conn = server.createobject("ADODB.Connection") conn.open “employee" set people=conn.execute(SQL) %> <% do while not people.eof set resultline=people(0) & “, “ & people(1) & “<BR>” Response.Write(resultline) people.movenext loop%> <% people.close %>
  • 35. Conclusions • Database technology is a required component for large-scale dynamic Web sites, especially E-Commerce sites • Web databases cover most of the needs of dynamic sites (except for text search) • Many solutions and systems are available for web-enabled databases