1139-1141

Previous Table of Contents Next

Page 1139

Figure 51.8.
The browser shelters
you from the
networking and
translation issues of
HTTP and HTML.

The browser's role will become more important in the coming years as the network computer (NC) gains popularity. When Oracle speaks of a low-cost NC on the desk of every classroom, it is really talking about a computer that is dedicated to only running a browser. The NC is not a dumb terminal, but a computer that simply requests information through its browser and receives information from a server. Yet the browser on the NC must still interpret the HTML or applet, display the output, and allow you to interface with the information, as would a browser on any machine.

For those of you who have been in the Oracle world a long time, a browser is similar to the SQL*Forms Runform utility. It simply reads files of generated forms applications (byte code) and follows their commands, sending information and graphics to the user and requesting information, in turn , from the Oracle database. A browser also has a role similar to the SQL*Net product; it shelters the user from a particular network protocol. With SQL*Net, you can request data from a different machine by only knowing a name, a database link, for that server. In the same way, when you use a browser, you use a URL, which appears as a name such as www.widgets.com. The browser translates the URL at a lower level through HTTP and magically hooks you to a computer thousands of miles away.

HTML and Oracle's Web Server

One product Oracle offers with its Web server is the Oracle Web Server Developer's Toolkit. This offers a way to perform HTML commands within a PL/SQL body of code. The power of this feature is that you have complete database access coupled with the HTML language. Here is an example of a PL/SQL procedure that queries a database to dynamically return a stock price to a user. The only input to this procedure is an identifier for the stock:

 create or replace procedure get_stock_price(ticket in varchar2) is current_price stock_prices.unit_price%TYPE; begin        select               unit_price               into     current_price           from stock_prices        where identifier = ticket;     htp.print(`This stock is now selling at: `to_char(current_price); end; 

Page 1140

A user who logs in to your Web site will access this procedure every time he or she enters a stock that he or she is interested in. Suddenly, with the a simple document markup language, you can create Web pages that have a complete, powerful accessing language to a database. This is the only layer of database connectivity that a Web page developer needs to be concerned with. If you have a common library of PL/SQL routines, you can make the database completely invisible to the Web page developers.

All of the HTML commands that we just learned will help you get started sooner with the Oracle Web Server Developer's Toolkit. These basic commands, along with others, can be called from a PL/SQL procedure:


HTML tag Oracle hypertext procedure
<html> htp.htmlOpen
</html> htp.htmlClose
<head> htp.headOpen
</head> htp.headClose
</body> htp.bodyClose

For instance, in an earlier example in which we used the body command to load a more interesting background for the Shakespeare text, we used the tag command:

 <body BACKGROUND="myfile.jpg"> 

We could actually issue this command within an Oracle PL/SQL block by issuing the command:

 htp.bodyOpen(`myfile.jpg'); 

The single quotes replace the double quotes because, in Oracle PL/SQL, a string is a single-quoted object and, in HTML, it is double-quoted. In fact, we could replace the complete HTML document that we created for William Shakespeare in the previous section and turn every marker into an embedded call within PL/SQL. When a user's browser accesses your Web site URL, the Oracle Web server would instead execute a PL/SQL stored procedure that would display the same Web page we created. I will leave this exercise to you.

The power of using a database such as Oracle with your HTML and Web server is obvious. Of course, one can publish Web pages without Oracle or any expensive tools. If we look at what is really happening when someone is searching the Web, we see users asking for data. If we had a Web page that might be accessed by thousands of users wanting large sets of data, a relational database would be a quicker way of storing and dynamically retrieving data than using simple flat files.

Another reason to use the Oracle Web server as a packet around your HTML is security. HTML files sitting alone on a Web domain are simply files in an operating system. Any hacker who can break into the file system that you are using can change, destroy, or view information that

Page 1141

you might not want them to have access to. There are many stories today of simple hackers breaking into famous Web sites and changing things around. If your HTML is embedded in PL/SQL, your source code HTML exists deep in the Oracle database in a data dictionary table and in the shared pool of your computer's memory. Now your potential hacker will need to be an operating system expert and an Oracle expert to take over your Web site.

After you go into the Web publishing business, you will have become an information server for the complete world. Deciding to use Oracle as your Web server is similar to deciding if you need a database for any group of users. Now, though, your users are the world community. Just like in a standard database architecture methodology, the more users you expect or the greater amount of data you want to store and display, the more important data access becomes. By embedding HTML in PL/SQL, you can realize the multiuser, security, data-indexing, and dynamic query potential of the Oracle database for all your customers who browse your Web pages. Using relational databases is an organized and efficient way of allowing multiple users to access large amounts of data; therefore, they are indispensable foundations for large-scale Web publishing and information services.

Oracle's ConText Product

There is an evolving subtopic in computer science on storing and understanding large textual documents. This area is referred to as natural language theory. In most companies, the amount of text that must be legally stored for years is staggering. Unfortunately, this technology has not been linked very closely with relational databases in past years, even though many of the concepts are the same. Oracle has been working to narrow this gap with its ConText option.

Oracle extends datatypes with ConText and treats a document as a data object, just like a date or number column. Documents are now stored directly into the Oracle RDBMS with ConText. Aside from text search-and-retrieval options, Oracle ConText offers linguistic capabilities. This means that Oracle, through a complex method of comparison and abstraction in relation to a knowledge base that you manage, will find rankings and themes for each document that you store using ConText. For instance, if you have set up the word "voltage" to link to a technical document, ConText will evaluate all incoming documents to the Oracle database and rank them to the degree that they mention voltage information. This is a form of indexing, but it is an index built on a set of documents and themes, rather than a simple datatype.

By quantifying and indexing the characteristics of a document, you are reducing it. Oracle uses a text-reduction function to produce either general or theme-specific summaries, called Glists. These Glists can be reviewed by the user as he or she is searching for a document.

An example of the ConText option would be a database at a Fortune 500 company with 10,000 employees listed and their original resumes. The CEO has just sent a directive to cross-train as many of these people as possible. If an opening in a department exists for a master wielder, this position will be offered first to an employee in another department before it is offered to the

Previous Table of Contents Next


Oracle Unleashed
Oracle Development Unleashed (3rd Edition)
ISBN: 0672315750
EAN: 2147483647
Year: 1997
Pages: 391

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