In this project we created a fictitious online shoe store called “E-Shoe Store” using a database-backed web server. Our focus was on building all of the different elements in such a manner that they work cohesively and seamlessly with one another while doing the job of updating and displaying the database information.
Throughout our implementation, we maintained the notion that this project will be used as a CS-564 project. In this respect, it is our idea that our project would have certain implementation details removed (e.g., generation of SQL queries) and these implementation details would form the basis of the CS-564 project. Additionally, this document could be used to provide background information about database-backed web pages to students.
Within the past decade, the growth of the Database industry and the Internet has revolutionized the way many people interact with information. This rapid proliferation and the cost effectiveness of new key technologies are creating large opportunities for developing large-scale distributed applications. For example, eCommerce, the leading Web-based application, is projected to exceed $1 trillion over the next several years. Newer companies, such as Amazon.com, as well as traditional ones such as Wal-Mart, all use the Internet to service customers, clients, and business partners. Some of these businesses pay consulting companies (e.g., Accenture) thousands of dollars to do the work of creating dynamic and marketable web pages to attract customers and maintain business-to-business relations. These companies all use an architecture in which the web pages are backed by database servers such as Oracle or DB2 to ensure that their content is up-to-date and to allow the efficient exchange of merchandise and/or information.
This architecture not only encapsulates how the data is stored, but also allows the data representation to be changed easily without affecting clients, queries to be optimized, and hosting thousands of connection requests at the same time. The highest link in the architecture is an HTTP or XML enabled Web browser running on the client side. Between the client and the database residing on a server, another component loosely referred to as the “Web server” serves the client's requests (translated to SQL queries if necessary) by passing them to the database and returning the formatted result appropriately to the client (see figure below). In addition, a CGI engine may be added to support legacy databases, or Java Servlets or CORBA brokers in more recent databases. Apache is such a Web server. These days, connections are generally made via TCP sockets even if both the client and the server are running on the same computer.
Most of the web pages on the Internet are "static" pages. They are merely HTML or text files, which are downloaded to a browser and displayed immediately. However, many web pages are not static pages at all—they are actually programs which produce HTML as their output, and then send that HTML to a browser.
Architecture of Static Web Pages and Dynamically Generated Web Pages
In order to create web pages dynamically, web servers need to execute a program through some server-side scripting mechanism. The script typically connects to a DBMS, performs a query (or a number of queries), retrieves the results, and formats the results into HTML, which is returned to the web server. A web page, either static or dynamically generated, can retrieve information from the user through HTML forms and pass the information to the web server when requesting a new page. This information is used as parameters for input to the server-side program. The server-side script can either generate the HTML itself or invoke another application to generate the HTML. In either case, a connection to a database can be made in order to obtain or modify information through queries.
One of the most basic ways to implement database-backed web pages is through the Common Gateway Interface (CGI). In fact, CGI was the first approach used for server side scripting, and is still used today. CGI is a simple protocol that specifies the way in which user-defined scripts that run at the web server can communicate with users’ browsers. Scripts that follow the CGI protocol are called CGI scripts. The CGI protocol dictates how form data should be passed from the web server to the script. Specifically, the data passed from an HTML form must be transformed into one long string of name-value pairs as in name1=value1&name2=value2&… When a CGI script is activated, it must parse this long string into name-value pairs. The CGI protocol also mandates that the standard output of the script is forwarded to the user. This means that the CGI script is expected to print the necessary HTTP headers first, followed by the results page in HTML.
The use of CGI, however, has declined considerably due to its significant performance shortcomings—each invocation of the CGI program creates a new CGI process to run the program; when millions of users are attempting to access a web site generated by a CGI program, the number of processes that are created can become a bottleneck for performance. Because of this limitation, many alternatives have been developed such as Microsoft’s Active Server Pages, Sun Microsystem’s JavaServer Pages (using Java Servelets), and PHP (Hypertext Preprocessor).