Agenda Database Definitions & Standards Architectures Server-Side Scripting Perl ASP JSP PHP Servlet XML
Structured Query Language SQL stands for Structured Query Language SQL is a standard computer language for accessing and manipulating databases. SQL allows you to: access a database execute queries against a database retrieve data from a database insert new records into a database delete records from a database update records in a database
SQL Database Tables A database most often contains one or more tables. Each table is identified by a name (e.g. "Customers" or "Orders"). Tables contain records (rows) with data. Below is an example of a table called "Persons": LastName FirstName Address City DaviesOla 20 Oldfield Way Bristol HansonNorman33 ParkSideLondon Asperone Michelle15 MargoletteParis The table above contains three records (one for each person) and four columns (LastName, FirstName, Address, and City).
SQL Queries SQL can query a database and have a result set returned. A query like this: SELECT LastName FROM Persons Gives a result set like this: LastName Davies Hanson Asperone
SQL Data Manipulation Language (DML) SQL (Structured Query Language) is a syntax for executing queries. But the SQL language also includes a syntax to update, insert, and delete records. These query and update commands together form the Data Manipulation Language (DML) part of SQL: * SELECT - extracts data from a database table * UPDATE - updates data in a database table * DELETE - deletes data from a database table * INSERT INTO - inserts new data into a database table
Layered Architecture local computer client browser Internet remote webserver
Server-Side Scripting Advantages No special client side software required Robust security model via encryption (https) Typical Activities Design and Author scripts For particular requirements To sell or provide for wider community Use existing scripts Script will need to be configured (setup) for individual use Access to cgi-bin required on host server
Server-Side Scripting - PERL Perl = Practical Extraction & Reporting Language Perl has powerful text-manipulation functions Used to process World Wide Web electronic forms Provides a Common Gateway Interface (CGI) for access to systems, databases, and users Freely available for several platforms, Windows, MAC, Unix, etc.
PERL Example - File Uploader $Data = "/Library/WebServer/Documents/remote"; #On your server, create a directory where this program will write the files # Make sure you CHMOD this directory to 777. If you do NOT specify a $Data #directory, the program will attempt to write to the web root directory. #NOTE: YOU SHOULD ALWAYS SPECIFY A DIRECTORY TO STORE THE UPLOAD @good_extensions = (); #If you want to limit the types of extension that can be uploaded, specify them #here by adding them to the array. For example, if you wanted to permit only #the upload of gif's, jpg's and png's, then you would set the above array to #look like this: #@good_extensions = ('gif', 'jpg', 'jpeg', 'png'); #
PERL Example - File Uploader $max_size = 5000; #Set the maximum size of each file that is permitted. For example, # if you only want #files to be uploaded that are under 50Kb in size, set the value to: #$max_size = 50; #If you set the value to zero, remove it or comment it out, then # the size of the #uploaded file will NOT be checked.
Java Server Pages Many Web pages that are built by CGI programs are mostly static, with the dynamic part limited to a few small locations. JSP is a technology that lets you mix regular, static HTML with dynamically-generated HTML. Similar to ASP but advantages are: Written in Java, not Visual Basic or other MS- specific language Portable to other operating systems and non- Microsoft Web servers
JSP Example Welcome to Our Store Welcome to Our Store Welcome, To access your account settings, click here. Regular HTML for all the rest of the on-line store's Web page.
PHP PHP Hypertext Preprocessor (Personal Home Page) (P-H-P) PHP started out as a wrapper around the Perl language. PHP is a server-side scripting language for HTML. Adds dynamic features to HTML pages or use it to create entire dynamic sites that generate HTML on the fly in response to user input. Syntax is a combination of C, Java, and Perl.
XML XML= Extensible Markup Language Markup? ‘Markup is a term applied to any set of codes or tags added to the contents of a document in order to indicate its meaning or presentation.’ XML is a meta language for constructing markup languages that reflect individual needs
XML XML is a markup language much like HTML XML was designed to describe data XML tags are not predefined. You must define your own tags XML uses a Document Type Definition (DTD) or a Schema to describe the data XML with a DTD or XML Schema is designed to be self descriptive
XML Example - Empire Burlesque Bob Dylan USA Columbia 10.90 1985