荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: Jobs (温少), 信区: Visual
标  题: XML Empowers Data Access APIs
发信站: BBS 荔园晨风站 (Sat Mar 11 16:21:09 2000), 转信

XML Empowers Data Access APIs

Combining the markup language with ODBC, JDBC, or ADO/OLE DB creates a
powerful nucleus for Web-based applications

By John Goodson


  By now, everyone knows that Extensible Markup Language (XML) is all
about data. Unfortunately, that's about all most people know about XML.
Depending on whom you talk to, XML is projected to be the framework for
replacing all software currently in existence, or is seen as an
interesting technology that should be watched over the next year or
two. The future of XML is certainly debatable, but it is clear that XML
is a "hot" new standards-based technology for defining the interchange
of data. But wait. Aren't there already standards-based technologies
for accessing data, such as ODBC? Will XML replace ADO/OLE DB? Do I use
XML in conjunction with or instead of JDBC? This article will provide
you with a clear understanding of how XML fits with the existing data
access standards such as ODBC, JDBC, and ADO/OLE DB. Additionally,
we'll look at the components that can be used to build an XML-enabled
business-to-business infrastructure.

First, let's briefly review the existing standards-based data access
specifications: ODBC, JDBC, and ADO/OLE DB.


ODBC (Open Database Connectivity) is an application programming
interface for accessing tabular data using Structured Query Language.
It is based on Call-Level Interface specifications for database APIs
from the X/Open SQL Access Group and ISO/IEC. ODBC is a mature,
cross-platform solution that's robust, flexible, and widely accepted in
the industry. Hundreds of commercial applications can use ODBC for
accessing data, including the Microsoft Office suite, Lotus SmartSuite,
and several Web servers such as Allaire's Cold Fusion.


JDBC (Java Database Connectivity) is also an API, based on
specifications from X/Open and ISO/IEC, that accesses tabular data
using SQL. JDBC is tailored for the Java programming language and fits
applications written in Java that access data. Unlike ODBC, JDBC is
object-oriented. It also provides some capabilities that fit well into
the Internet paradigm, such as providing disconnected access to data.
That is, a JDBC thin client can request and receive records over the
Internet, update the data from the thin client, and return the data
across the Internet for resynchronization with the database server.
Almost all commercial Java-based apps that access data do so using
JDBC.

Microsoft ActiveX Data Objects (ADO) is a high-level, object-oriented
API that applications can use to access all types of data on the
Microsoft Windows platform. ADO provides an interface to OLE DB, a
low-level API, which provides the underlying access to backend data
stores. ADO/OLE DB does not require SQL to access data. Instead,
ADO/OLE DB defines interface definitions for a variety of data types,
including tabular, non-structured, semi-structured, and OLAP data
types. Like JDBC, ADO/OLE DB provides some "Internet friendly"
capabilities, including read/write access to disconnected data and the
ability to persist record sets into Internet-ready formats, including
XML. ADO/OLE DB can be used to access data from Web servers, such as
Microsoft's Internet Information Server, and from any application built
with tools such as Microsoft's Visual Basic.


How does XML fit?
XML was built on a set of guidelines that parallel the best attributes
of all the aforementioned technologies. XML was built to be used over
the Internet by a wide variety of applications and to be
platform-independent. But XML is not an API like the other data access
standards. XML defines a markup specification language. You must write
a program to do something with an XML document because a document
doesn't do anything inherently. A visit to the World Wide Web
Consortium's architecture domain for XML (www.w3.org/xml) shows that
XML is a family of technologies. And within this family exist a couple
of different XML APIs: Document Object Model (DOM), produced from a W3C
working group; and Simple API for XML (SAX), developed from discussions
that originated on the XML-DEV mailing list. These APIs are used to
access and manipulate XML documents, not to interface with back-end
databases. Clearly, the greatest value is gained by using XML with live
data. Corporate data will continue to originate from database
management systems and packaged applications, not from an XML document.


Several database vendors say they plan to provide ways to use XML to
interface with their database engines. These solutions, while built
atop various XML standards, can provide access only in a proprietary
way until the vendors agree on a common solution. Currently, the only
data access methods based on industry standards are ODBC, JDBC, and
ADO/OLE DB. If standards are important to your organization, leveraging
XML with these existing data access standards may be the best approach
to building applications.


Now let's examine how XML can be used to give businesses new and robust
capabilities. Leveraging the Internet tops the list for most corporate
IT departments. However, leveraging the Internet involves exchanging
data over the Web. As the Internet grows, data will be exchanged not
only with consumers but also with other businesses. For example, a
consumer who orders business supplies online might trigger a
low-inventory event in the wholesaler's online commerce system or ERP
system. This event, in turn, could trigger an immediate re-order of the
item from the wholesaler to a supplier. Before the order was actually
placed from the wholesaler, the inventory levels of the supplier could
be checked to make sure the product was in stock. If not in stock, the
wholesaler could choose an alternate supplier.


Traditionally, the wholesaler would have chosen to provide an online
catalog of merchandise in HTML format over the Web. Using XML, the
wholesaler could now provide its online catalog in XML format, adding
the semantics to the catalog information that allow the consumer to do
business with the wholesaler in many possible ways. For example,
large-volume consumers could now use scripts or programs to query the
wholesaler's XML catalog and, similarly, could place orders more
efficiently. If the catalog were in HTML format, the catalog
information would have no context, and writing scripts or programs to
interact with the catalog pages would be difficult.


Several ways to expose data
Technically, there are several ways to expose data as XML, but let's
examine how to do this using the existing data access standards. Most
likely, the wholesaler's catalog information is stored natively in a
relational database inside the wholesaler's Internet firewall. Through
either the JDBC or ADO/OLE DB APIs, the wholesaler could read the
catalog information from the relational database and persist that
information to the Web server as an XML document. Using JDBC, the
catalog information would be requested from the database through a SQL
SELECT command. The rowset interface could then retrieve the data and
save it as an XML document, which could be exposed to consumers on the
Web. Similarly, using ADO, the resulting data could be persisted to an
Active Server Pages request object. The following ADO code fragment
shows how simple exposing data to the Web can be with XML:




Set Rs = server.CreateObject ("ADODB.Recordset")
sql = "SELECT ITEM_NO, PRICE, DESCRIPTION, NUM_IN_STOCK,
PHOTO " & _
"FROM ALL_STOCK ORDER BY 3"
Rs.Open sql, "dsn=Office Supplies;uid=johng;pwd=06TC14;"
Rs.Save response, adPersistXML

Once the wholesaler has exposed the catalog on the Web as an XML
document, the catalog can be viewed using an XML-enabled browser.
Customers can interact with the wholesaler more efficiently by using
automated application programs. These programs, or scripts, could
interact with the catalog as if they had direct access to the
wholesaler's relational database. Software components that implement a
data access API for a specific data format are called drivers. Today,
there are drivers available to XML documents for the ODBC, JDBC, and
ADO/OLE DB data access standards. A consumer application could
"connect" to a URL that specified the wholesaler's XML catalog using an
XML driver. The application could then use the catalog data in any way
available through the data access API.



The combination of standards-based APIs and XML provides a powerful
business-to-business framework. XML is similar to other standards-based
technologies, such as ODBC or JDBC, in using a common programming
interface for accessing and manipulating data. It differs in that the
XML programming interfaces are immature in terms of security, query
languages, updating, and access to back-end data stores.


XML extends the typical data access API, however, by adding Web
enablement and a common data format for persistence. Using XML with the
existing data access standards leverages the best of both worlds by
providing a powerful nucleus for building Web-enabled, business
applications.



John Goodson is VP of research and development at Merant. He has spent
his entire career focusing on databases and data access APIs. He can be
reached at John.Goodson@merant.com.

   Links
? World Wide Web Consortium

XML Links
Back to XML Table of Contents

? XML Zone

? Ask the XML Pro

? XML Discussion Group

? XML Magazine Home

? Subscribe to XML Magazine




--

   好好学习,天天向上!!!!

※ 来源:·BBS 荔园晨风站 bbs.szu.edu.cn·[FROM: 192.168.11.111]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店