Chapter 24. How Websites Work with Databases


One of the most useful applications of the Web is its capability to link a website with a database so web surfers can search for information. In essence, the web page becomes the front-end for database applications, enabling you to select search criteria and execute even complex searches of a database that resides on the host computer.

A well-known and widely used example of this type of linking between website and databases is the popular Yahoo! website (www.yahoo.com). The Yahoo! site serves as a front-end to an extensive database of website descriptions, which can be searched according to keywords. The Welcome page includes a search dialog box in which you enter a keyword that represents the subject matter you are looking for. Clicking the Search button sends a request from the browser to the web server to bring back a list of all websites that contain your keyword.

Not only can the Web serve up data, it can also collect it. For example, many websites ask users to "register" their names, addresses, and other demographic information, which is then captured and stored in a database.

But how does this all work? You don't have to be a corporate giantor for that matter even a capable programmerto link your website to a database. In fact, linking a website to a database can be relatively simple. The database can take just about any form and can be as simple as a FileMaker Pro database or as complex as an Oracle SQL database. A variety of technologies bridge websites and databases, including Perl, .NET, Common Gateway Interface (CGI), and others. (For more information about CGI, turn to Chapter 35, "How CGI Scripting Works.")

On the client side of the database, you see a web page that includes a form in which you enter your search terms. When you execute the search, the web server passes your search information to a CGI script, which then searches the database. So a search on the Yahoo! site for public relations firms might look like this:

http://search.yahoo.com/bin/search?p=public+relations

When the web server receives this URL, it identifies the URL as a trigger for a CGI script (called search in this example) and passes it along with the search criteria ("public relations," in this example) to the miniprogram using CGI. The CGI script then sends the search to the database, receives the results of the query, and passes it on to the web server to be sent back to the client. That's a lot of handing off of requests and data, but typically even a search of a large database is very fast because the majority of Linux, Unix, and Windows-based databasesthe types most often usedcan perform these tasks simultaneously. All this happens behind the scenes, of courseyou won't need to do any kind of database work or scripting yourself. Instead, the websites you visit have easy-to-use interfaces that take care of interacting with databases; you'll have to type only what you're looking for.



How the Internet Works
How the Internet Works (8th Edition)
ISBN: 0789736268
EAN: 2147483647
Year: 2004
Pages: 223

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net