Chapter 28

Using Web-to-Database Query Tools


The most important information on an intranet typically is housed in databases. These databases can be on a single site, although typically, they can be found all across an entire intranet.

Most of these databases have been around since long before the Internet became popular, and before any corporate intranets were built. That means that they've been built without TCP/IP in mind, without HTML in mind, and without taking into account any other intranet technologies. Before the intranet was built, they were accessed in a variety of ways, depending on the particular kind of database and access software used.

An intranet can theoretically make it much easier to get at all that corporate data. The use of HTML means that it's relatively easy to build search forms that anyone can use to easily get at data-data that in order to get at, people previously may have been required to know a database programming language.

However, while it's easy to build HTML search forms that let people type in queries, it's not so easy to actually have those queries be sent out to search through a database, and then to have the results be delivered back to whoever did the searching.

That's what Web-to-database query tools are designed to do. They're designed to let anyone, without having to understand database languages, easily get at the vast corporate resources locked up in databases.

Since the databases typically were built before the intranet, some means of getting at them from an intranet, and specifically from the Web, needs to be designed. There are many different ways of accessing corporate databases from an intranet. A popular one is to use the Common Gateway Interface (CGI). CGI enables people on the Web to access resources that aren't directly located on the Web. Through the use of CGI scripts, an intranet programmer can allow someone from the Web to query a database, and have that database send back information that is put into a preformatted HTML page. This makes it easy for anyone, using a standard Web browser such as Netscape Navigator or Internet Explorer, to access corporate databases.

What will undoubtedly prove to be popular is the Structured Query Language (SQL). SQL is a database language that works on a client/server model, as does much of the Web. In the SQL model, the database itself is separate from the software that accesses the data-in other words, the software used to access the database is the client, while the database itself is the server. There can be many different kinds of clients to access the same underlying database. One such client can be a CGI script that takes the input form on the corporate Web, converts its contents into an SQL query, and submits it to the database server. Another client could be a Java applet that allows for the creation of more complex queries and better data display than standard HTML.

How Web-to-Database Query Tools Work

The most important information on most intranets exists on databases that were created long before the Internet became popular, and before intranets were ever created. They use technology built without the TCP/IP protocols or the HTML language in mind. However, there needs to be some way for people on an intranet to access and use that data. A variety of techniques have been developed for doing this that involve allowing people to search the databases from within a Web browser.

  1. When someone on an intranet wants to gain access to a corporate database, he or she will typically use a Web browser and visit a particular home page. This home page sits on a Web server that essentially acts as a front end to the database. The database in fact sits on another computer on the intranet, not the Web server.
  2. When someone wants to search a database, they use a form built with HTML. After they type in search terms, the search terms are sent using a Common Gateway Interface (CGI) script. CGI is a method that enables databases and other resources to be accessed from the Web. CGI scripts can be written with a number of different tools and programming languages, including UNIX's Perl, or the C programming language.
  3. The CGI script is programmed to take the information entered on the Web form and translate it into a properly formed SQL query the database server can process.
  4. The CGI script now acts as a client to the database server. It makes a connection to the database and submits the SQL query it created. To the database server it appears to be just another client connecting rather than a connection via a Web browser.
  5. The database performs the requested query and sends the matching records back to the CGI script. These results are properly reformatted through the addition of HTML tags.
  6. The formatted information from the database is sent back to the browser that requested it. The user can now use that HTML page like any other HTML page.