Title: Web Server Administration
1Web Server Administration
- Chapter 7
- Installing and Testing a Programming Environment
2Overview
- Understand the need for programming languages
- Understand database management systems (DBMSs)
- Install and test DBMSs
- Understand the Web-based programming environment
- Program with databases
3The Need for Programming Languages
- Web pages with just HTML statements are static
pages - Pages that contain programming statements allow
changes and they are called dynamic pages - Programming languages can also be used to update
databases and communicate with other systems
4Database Management Systems (DBMSs)
- The purpose of a DBMS is to store data in an
organized manner for further processing - Structured Query Language (SQL) is the language
used to define and manipulate the data - Most databases are relational and organize data
into tables
5Database Tables
- A primary key uniquely defines a row of data
- SSN in the Employee table and Department number
in the Department table - A foreign key is a column in a table that is
related to a primary key - Department number in the Employee table
6Three Categories of SQL
- Data Manipulation Language (DML)
- Used for programming and to insert, update,
delete, and retrieve data - Data Definition Language (DDL)
- Used to create tables and other related
structures in a database - Data Control Language (DCL)
- Allows you to control access to tables
7Installing and Testing SQL Server
- As with other applications, a wizard guides you
through the installation - By default, it uses the user name you logged on
as (typically administrator) to gain access to
the system - This should be changed to "Use the Local System
account" for single server systems - If SQL Server needs to communicate with other
servers, create a special domain account
8Installing and Testing SQL Server-Authentication
Mode
- The Windows Authentication Mode controls access
to the database based on Windows users - The Mixed Mode allows for SQL Server
Authentication - This is more appropriate for Web-based systems
- The sa (systems administrator) account is a SQL
Server user that has complete control over the
databases
9Installing and Testing SQL Server-Creating Tables
- The GUI interface is similar to Access in
creating a table
10Installing and Testing SQL Server-Filling Tables
with Data
- Although SQL statements are often used to
manipulate data, you can use something similar to
a spreadsheet
11Installing and Testing MySQL for Red Hat Linux
- As with other applications, you run an RPM file
- Start MySQL with /etc/rc.d/init.d/mysqld start
- The command-line interface is accessed withmysql
- Create a password for mysql root account withSET
PASSWORD FOR rootPASSWORD('password')
12Login to mysql and Create a Database
- To login from the shell prompt use
- mysql uroot ppassword
- To create a database called hrcreate database
hr - In order to do any operations on the database
such as create tables, you have to "use" ituse
hr
13Create Tables and Insert Data
- The following script creates the employee table
and adds three employees - create table employee (
- ssn char(9) primary key,
- firstname varchar(20),
- lastname varchar(30),
- deptno char(2),
- salary numeric(6))
- insert into employee values('553879098','Lynn','Gw
eeny',10,55000) - insert into employee values('623827368','Elark','K
aboom',10,60000) - insert into employee values('756838998','John','Do
h',20,45000)
14Web-based Programming Environment
- Cookie
- Text that a Web site stores on your disk
- Common Gateway Interface (CGI)
- A protocol that allows the operating system to
interact with the Web server - Practical extraction and reporting language
(Perl) - First popular language for Web servers
- Java Server Pages (JSP)
- Language similar to Java
15Web-based Programming Environment
- Active Server Pages (ASP)
- Script-based environment available on all IIS Web
servers - ASP.NET
- Compiled programs operate under .NET Framework
- .NET Framework is an integral part of Windows
Server 2003 and can be installed on Windows 2000 - PHP Hypertext Protocol (PHP)
- Popular language available on most platforms
- The structure of JSP, ASP, and PHP are similar
16Using Forms
- The following HTML produces a form
- When the submit button is pressed, the data in
the form is sent to the file designated as
filename
17Using ASP to Process a Form
- The following file displays the information from
the form - Notice how the items such as "first" match the
text names on the form - ASP uses lt and gt for opening and closing tags
- ltrequest()gt is one way to retrieve data from
the form
18ASP.NET
- ASP.NET is one of the many languages available
under the .NET Framework that can be used for the
Web - The programming model of ASP.NET is superior to
that of ASP - Has modules for data validation that
differentiates between browsers - Producing sophisticated reports is much easier
19ASP.NET Program that Combines Form and Output
20Shell Script in Linux
- Uses CGI
- First line states that the shell is being used
- Not common because of lack of security
21Perl Script to Display Contents of a Form
- Notice how cgi-gtparam("first") is similar to
ASPs request("first")
22Programming with Databases
- Microsoft uses two methods to bridge the gap
between programming languages and databases - Open Database Connectivity (ODBC)
- The original standard
- Object Linking and Embedding Database (OLEDB)
- Current standard which is faster and more
flexible - Linux often uses Java Database Connectivity
(JDBC) - You can also have a direct connection between the
language (such as PHP) and the database (such as
MySQL)
23Producing a Report
- Connect to the database
- Execute a SQL select statement to retrieve data
from a table - Put the data in a recordset
- Also known as a resultset, depending on the
environment - Loop through the recordset and display the
contents
24A Report in ASP
25Using Data Source Names (DSNs)
- DNSs are connections to databases that an
administrator creates on the server - They encapsulate the information on the previous
slide concerning the connection information - The Data Sources (ODBC) wizard is in the Control
Panel - Once it is created, you can create a connection
withConn.open "DSNhumanresourcesuidsa"
26Programming with ASP.NET
- Although there is a connection and you send it a
SQL select statement, the DataGrid component
creates the report
27Programming with PHP
- Note the similarity between ASP and PHP, and how
different they are from ASP.NET
28Summary
- Programming languages process data, allow you to
create dynamic Web pages, and can produce other
features - Database management systems organize data for
processing -