Chapter 1 Databases and the Internet
This section describes how databases can connect to the Internet using a application server, or gateway. It also describes the information commonly stored in databases.
For a Web server to retrieve information from a database, an intermediary application server or gateway is required between the Web server and the database management system (DBMS). Such an intermediary must have an interface to the Web server, and an interface to the DBMS. The most common Web server interface is named CGI. Each DBMS has a native interface; open interfaces such as ODBC and Open Client are also available.
CGI (Common Gateway Interface) is a standard Web server interface. When a Web server receives a URL corresponding to a CGI resource, it starts a CGI program (such as a perl script, or the PowerDynamo Application Server) which connects to the DBMS, queries the database, and returns the information to the Web server to be handed on to the Web client.
CGI is a standard for interfacing any external application with a Web server, not just a DBMS. CGI applications may also simply process files. The output of the CGI program or script is returned to the Web server. This output can be an HTML document, an image, a reference to another document, or any other form of information understood by the Web server.
CGI is an industry-standard Web server interface. Some Web server vendors also provide proprietary interfaces to their servers: NSAPI (Netscape Application Programming Interface) and Microsoft ISAPI (Internet Server Application Programming Interface) are two examples supported by PowerDynamo.
An HTML document stored in a file is an example of a static Web page; its content does not change unless the file itself is edited.
With application servers, you can create dynamic Web pages, which are generated each time they are accessed. Dynamic pages have features not found in static Web pages:
A dynamic Web page can any combination of:
The static components of the page are stored in an HTML document called a template. The template consists of the static HTML text (which is passed on to the Web client without change) together with the query or other instruction defining the dynamic component of the page, and the layout instructions governing the display of the data.
The query tags are interpreted by the application server and replaced by a result set when the document is generated. The application connecting the database to the Web server replaces the query with its data, formatted according to the instructions, and sends the resulting page to the Web server for relay to the Web client.
This section describes some of the types of data that can be stored in a database for Internet access. This information falls into two broad categories:
Existing data in a database can be accessed from the Internet using an application server. In this case the application server merges an HTML document (which may exist inside or outside the database) with information stored in the database, and sends the resulting HTML document to the Web server.
For example, a dynamically generated Web page might display pictures and descriptions of a product line, which are stored in HTML files, but fill in the prices, contact information, and other information from the database.
HTML documents themselves may be stored in a database. At its simplest, the task of the application server is then to execute a query that retrieves the HTML document from the database and passes it on without change to the Web server.
Images and other non-HTML information may be stored in a database instead of being stored in a file. When the image is requested, the application server retrieves it from the database and hands it on to the Web server.
An application server can retrieve an HTML document from the database, fill in part of the document from data stored elsewhere in the database, and also provide images and other external resources associated with the document from the database.
Copyright © 1999 Sybase, Inc. All rights reserved. |