Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

DB2

Posted Apr 1, 2008

Understanding DB2: Learning Visually with Examples - Page 3

By DatabaseJournal.com Staff

1.2.4 Web Services

A Web service, as its name implies, is a service made available through the Web. A more formal, but still simple definition states that a Web service is a way for an application to call a function over the network; however, there is no need to know

  • The location where this function will be executed

  • The platform in which the function will run (for example Linux, UNIX, Windows, the mainframe, Mac OS/X, etc.)

  • The programming language in which the function was created (for example Java, Cobol, C, etc.)

Web services are powerful because they allow businesses to exchange information with minimal or no human intervention. Let's go back to the supermarket example to see the power of Web services in a more realistic scenario:

Let's say you order 100,000 cookies from a supplier, expecting all of them to be sold in one month. After the month passes only 60,000 are sold, so you are left with 40,000. Because these are cookies of a special kind, they will spoil in two weeks. You need to act fast and sell them to other smaller supermarkets or Internet companies such as Amazon.com or eBay. You can grab the phone and spend an entire morning calling each of the smaller supermarket clients, offering them as many cookies as they would want to buy from you; or you could take a more "technical" approach and develop a simple application that would do this for you automatically. Assuming each of these smaller supermarket clients provide Web services, you could develop an application (in any programming language) that allows you to SQL insert overstocked items, such as the 40,000 cookies, into a DB2 database table overstock. You could then define a trigger on this table which invokes a DB2 stored procedure (more about triggers and stored procedures in Chapter 7, Working with Database Objects) that could consume Web services provided by the Internet companies or the smaller supermarket clients. This scenario is depicted in Figure 1.5.

Figure 1.5
Using a Web service

As you can see from Figure 1.5, the simple act of inserting 40,000 cookies through your application into the table overstock in the DB2 server allows the systems of many smaller supermarkets and Internet companies, through the use of their Web services, to make the cookies available on their systems quickly, opening new sales channels. In Figure 1.5, DB2 is behaving as a Web service consumer, because it is using or "consuming" the Web services, while the smaller supermarket clients and Internet companies are behaving as the Web service providers, because they are making these Web services available for others to use. For simplicity purposes, we have omitted in Figure 1.5 the call to a stored procedure. This scenario shows the power of Web services: business-to-business exchange of information using applications. There is no need for human intervention. DB2 and Web services will be discussed in more detail in Chapter 10, Mastering the DB2 pureXML Support.

1.2.5 XML

XML stands for eXtensible Markup Language. XML's popularity and use has grown exponentially in the past few years, as it is a core component of many new technologies. The easiest way to understand how XML works is by comparing it to HTML, given that many people today are familiar with HTML. Let's take a look at the following line in an HTML document:

<b>Raul</b>

In the above line, the tag <b> indicates the way you would like to display the text, in this case, Raul in bold. Now Let's take a look at the following line in an XML document:

<name>Raul</name>

In the above line, the tag <name> describes the text Raul. The tag is saying that Raul is in fact a name. See the difference? In HTML, tags are used to indicate how you would like to display the data; in XML, tags are used to actually describe the data. Table 1.3 describes the characteristics of XML.

Table 1.3 Characteristics of XML

XML Characteristic

Description

Flexible

XML is a flexible language because it is easy to modify or adapt. XML is based on a hierarchical model, which is most appropriate to store unstructured types of information such as financial information, life sciences information (for example Genome, DNA), and so on.

Easy to extend

XML is easy to extend; that is, you can create your own tags. For example, in addition to the <name> tag in the example above, you could create new tags such as <address>, <email>, <phone>, and so on. This means you can create your own language or protocol based on XML.

Describes itself

XML can describe itself; another document called an XML Schema (which itself is an XML document) is used to provide rules and descriptions as to what each of the tags in a document mean and restrict the type of data the tags can contain. An older method, but still widely used today, is to use DTD documents. In the above example, an XML Schema or DTD document can indicate that the tag <name> can only be used to store characters.

Can be transformed to other formats

XML can be transformed to other formats like HTML, using Extensible Stylesheet Language Transformations (XSLT), a language used for the transformation of XML documents.

Independent of the platform or vendor

XML is independent of the platform or vendor; after all, XML documents can be stored in text files containing tags. Text documents are supported everywhere.

Easy to share

XML is easy to share with other applications, businesses, and processes given that it can be stored as a text document. Because it is easy to share, it's appropriate as the core of Web services.

XML is also at the core of Web 2.0 development technologies. Web 2.0, as defined in Wikipedia.org "refers to a perceived second generation of web-based communities and hosted services—such as social-networking sites, wikis, and folksonomies—which facilitate collaboration and sharing between users". Wikis, blogs, mash-ups, RSS or atom feeds, and so on, which are part of Web 2.0 development technologies, are all based on or related to XML. This makes DB2 9.5 the ideal data server platform for Web 2.0 development. Table 1.4 describes the different technologies that are part of Web 2.0.

XML is discussed in more detail in Chapter 10, Mastering the DB2 pureXML Support.

Table 1.4 Web 2.0 Technologies

Web 2.0 Technology

Description

AJAX

Asynchronous Javascript and XML: A technique for creating interactive Web applications, which can update parts of a Web page without refreshing the entire page.

AdSense

This is an advertisement serving program where Web site owners can enable text, image, and video advertisement on their site, and ads will appear based on the Web site content, the user's geographic location, and other factors.

Blog

Also known as a Web log, this is a Web-based publication of periodic articles in journal style displayed in chronological order. It is often used to provide personal commentaries on a subject or as personal online diaries.

Mashup

This is a Web application hybrid, that is, a Web site or application that is derived by aggregating components or services from other sources such as RSS or atom feeds, and JavaScript.

REST

Representational State Transfer: An architectural style for distributed hypermedia systems like the World Wide Web.

RSS and Atom

RSS (Really Simple Syndication) and Atom are XML file formats for Web syndication, which provides a way to distribute information.

Tagging

Bookmarks that provide a way to attach keywords to pages or images on the Web, helping categorize and making things easier to find (i.e, metadata).

Wiki

A type of Web site that allows for community authoring (add/delete/edit content).

1.2.6 DB2 and the IBM Strategy

Now that you understand the key concepts of the overall IBM strategy, you may be asking yourself, how do these concepts relate to each other? Where does DB2 fit in the overall strategy? To answer these questions, let's take a look at Figure 1.6.

Figure 1.6
The role of DB2 in the IBM strategy

As shown in Figure 1.6, an on-demand business depends on Information On Demand, which depends on Service-Oriented Architecture, which depends on Web services, which depends on XML. The figure shows why XML is so important: XML is at the base of all of these concepts; without it, they would be hard to implement.

XML documents need to be stored in a safe place that allows for storing, managing, and retrieving large volumes of these documents. Persistency, scalability, security, recovery, and good performance are all important features to consider when selecting a repository for your XML documents. All of these features have already been provided for many years in databases; therefore, a database is probably the best repository for XML documents. DB2 has been providing support to work with XML documents for several years. Starting in version 9, as described earlier in this chapter, pureXML technology is made available, which greatly enhances performance by internally storing XML documents in a parsed-hierarchical manner, as a tree. Thus, in summary, the role of DB2 in the Information On Demand world is to be the repository of XML documents. This is why DB2 is shown at the bottom of the figure, supporting all the other technologies.



DB2 Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 



















Thanks for your registration, follow us on our social networks to keep up-to-date