Connecting Web sites to Database Systems
What You’ll Learn in this set of notes
Just about any database system of reasonable size will ultimately require a web based user interface or a mobile app based user interface.
In this set of notes we introduce how the web browser, web server and database management system interact. Specific topics include:
- Web/Database Integration – Web 1.0
- Web/Database Integration – Web 2.0
- JavaScript, AJAX, MySQL and PHP Example
- eXtensible Markup Language (XML) data
- XSQL Query Language
Textbook Resources
Connolly/Begg/Holowczak (BDS) | Elmasri/Navathe (3rd ed.) | Connolly and Begg (5/6th ed.) | Concepts of DB Management Pratt and Last |
---|---|---|---|
Chapter 15 | Chapter 27 Section 27.1 | Chapter 3, 30 and Appendix L |
Chapter 9 |
Web/Database Integration – Web 1.0
Note: The discussion here assumes you are familiar with HTML and can create simple web pages and HTML forms. If you are new to HTML, it is strongly recommended you take time out to learn a few basic things and be able to create your own web pages from scratch (i.e., writing HTML by hand). There are many tutorials available such as this one for getting some hands-on experience with HTML.
- Organization have discovered that database can provide excellent content for web pages.
- Many examples: Retail store with current products and price lists, On-line banking- banks with account balance information, Employee directories, etc.
- Several approaches to making database data available on-line:
- Periodically dump a database table to an HTML file and make the HTML file available on the web (e.g., MS Access Internet Wizard).
- Provide a mechanism to query the database in real time and format the results in HTML.
- Provide the web user with a form or other means to invoke a query on the database in real time. Results are formatted in HTML and returned to the user’s browser.
- Provide a Mobile App that invokes a query on the database in real time. Results are formatted by the app for display to the user.
- Several ways to carry out dynamic real-time queries from the web:
- Using traditional HTML forms, information is passed to a CGI script that formats the query and submits it to the DBMS. Results are returned to a script which then formats the output in HTML.
One needs: An HTTP (web) server, some language (e.g., Perl) that supports CGI, middleware to connect to the database, the DBMS.
Considered “Web 1.0” but is still implemented by many sites currently in use today.For example: IBM’s Net.Data provides a CGI software with it’s own macro language for processing queries and other types of transactions on DB2 databases.
- Here is a one of my videos explaining this architecture and hoe some of Baruch’s CIS courses fit into it.
- Many DBMS now have the web server built in (or closely tied) to the database. e.g., Oracle Web Applications Server. Stored procedures in the DBMS are used to accept input from HTML forms, perform the appropriate query and then format the results in HTML.
As an example, consider Oracle 11g and Oracle 12c, where the web server is built into the database. - Using “Software as a Service” (SaaS). A web service that accepts requests from your web or mobile application. The Web Service then handles querying and manipulating the data on the back-end database.
- Using traditional HTML forms, information is passed to a CGI script that formats the query and submits it to the DBMS. Results are returned to a script which then formats the output in HTML.
Web/Database Integration – Web 2.0
- JavaScript
- AJAX
- REST