Developing in PowerBuilder

John Olson

Subscribe to John Olson: eMailAlertsEmail Alerts
Get John Olson: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: Java EE Journal, XML Magazine

J2EE Journal: Article

XML vs XML

Communication vs data storage

If you are up-to-date on XML features in RDBMSs, then you know that ASE, Oracle, DB2, and SQL Server are leapfrogging each other in a race to add XML features to their relational databases. With each new release comes a new array of features. If I were to read a competitive analysis of the products, I'd have to ask what day it was written on in order to know which point release of each product is being covered. The products are changing that quickly.

For ASE the foundational XML features were added in 12.5, then progressed in 12.5.1 and in 12.5.2 (the latest release) with more to come in 12.5.3 - to be released shortly. ASE 15.0, which is on the horizon, is a huge leap forward in many feature areas including XML support. Does this mean that the older versions of the databases don't support XML? Yes and no. It is correct that older versions have no XML-specific features, but since XML is a text string format it's possible to store XML strings in any database that provides string storage.

The confusion often occurs when people mix up XML communication, XML data storage, and XML functionality. They are distinctly different things. Because of that confusion a common yet misguided comment about ASE 11.5 (or any version prior to 12.5) is "because we are using ASE 11.5 we can't use XML." That statement implies that it is preferable to use XML to communicate with the database, but 11.5 doesn't support XML communication, which is a roadblock to implementing XML communications. It is true that 11.5 does not support XML communications and does not have embedded XML functionality. Those are both annoyances, but neither is needed to store XML data in the database. In addition, XML communications could be used, but they would have to be supported by the application server because they aren't by ASE 11.5.

XML is simply a string format in which the string contains text descriptions (descriptors) for the data in the string. These descriptors allow a parser to find information in the string without the string having a predefined format, so fixed-spacing formats are no longer necessary.

XML-formatted data (self-describing) is used for communications and is also used for data. One of the first XML features the RDBMS companies added to their products was the ability to store XML documents. This simply means that an XML string can be stored in its entirety in a cell in the database. Under the hood the databases use blob, image, or string data types because XML documents are simply text strings. XML doesn't have to be used when putting the data in the database or pulling it out. The client can use ODBC, JDBC, or native drivers to pull the data out using a standard SQL Select. XML data is not reliant on XML communications.

XML communications is also not reliant on XML data. When we talk about Web services, we're talking about XML being the format of the communication between the client and the Web service. Typically this is implemented using SOAP messages that look a lot like network packets. Each packet has a payload, which is the data being delivered, that also contains a bunch of info about the address the packet is targeted for: security info, length of payload, etc. A SOAP message contains all that info in an "envelope." The envelope is simply a string of instructive information in XML format. The payload contained by the envelope, the "body," doesn't have to be XML but is wrapped in an XML descriptor in the envelope. The SOAP message is an XML-formatted string that's delivering data that may or may not be formatted XML.

That's probably clear as mud...the point being that "XML in the database" and "XML as a means of communication" are two entirely separate and unrelated things. The only thing in common is the term "XML," which happens to be the format they both use.

Back to the original question: Do we need to communicate with the database via XML? The answer is that it depends on what we are trying to achieve. The Web service must communicate with the client via XML. If the Web service is a Java component hosted on an application server, then it can communicate with the database via JDBC without using XML. Even if the data is stored as XML, it will be extracted as a string (which is what it is) and delivered as a string to the Web service. The Web service will transform it to the appropriate XML format, then send it out via the SOAP engine, which will wrap it in a SOAP envelope and deliver it to the caller. Though ASE 11.5 does not have XML-specific features, we can store XML documents.

I believe the confusion revolves around the idea of exposing Web services in the database, which means the database serves up the Web service. To accomplish this the database engine runs an embedded stripped-down application server (J2EE container) and provides functionality that would normally be hosted on a full-blown application server. In this case the SOAP messaging is going to the database or, more accurately, to the application server that is running in the database. Stating it that way is a bit nitpicky though because the embedded application server is invisible to the client, which is making a SOAP call to the database.

To wrap this up...if we want the database to host our Web services, we need ASE 12.5 or later. If an application server will host the Web services, ASE 11.5 is sufficient for data storage.

If we want to store XML documents in the database, we can store them as strings in ASE 11.5, but if we want the database to provide XML-specific features, we need to move to 12.5 or later.

We should move to 12.5.2 ASAP to take advantage of the new XML features. However, we should only see 11.5 as a roadblock if:

1.  We need to host Web services in the database because we don't have an application server to host our Web services

or

2.  We need XML data functionality in the database (e.g., support for XPath/XQuery, XML document indexing, etc.)

ASE TechWave Courses
To learn about the XML features in ASE 12.5.x we recommend these TechWave 2004 sessions.

ASE126: New XML Functionality in Adaptive Server Enterprise 12.5.2: A Tutorial
In ASE 12.5.1 a native XML engine with an XPath query processor was introduced. This engine supported many powerful features such as set operators, descendants, wildcards, and text retrieval. Although a lot of information about XQuery and XPath is available on the Internet, this information lacks sufficient depth to get application developers motivated to use the XPath offerings in the ASE. In this tutorial the basic XPath operators are reviewed with an emphasis on using traceflags to effectively debug applications. Also introduced is the new functionality in ASE 12.5.2 including XPath string functions, support for parenthesis operator, and FOR XML. This in-depth presentation will attempt to motivate users to write novel queries and explore new possibilities for developing applications.

ASE127: What's New in Adaptive Server Enterprise 12.5.2
This session explores a number of features bundled into ASE 12.5.2 that are geared toward several key issues. These feature sets address security, scalability on the 32-bit Linux platform, and Enterprise Information Integration (EII). With PAM authentication support and many other features, ASE can now provide a secure environment for enterprise data. Large memory support on the 32-bit Linux platform lets users migrate to low-cost servers without compromising performance. With real-time data services support and Web services functionality coupled with native XML processing, ASE seamlessly integrates with the EII architecture. In addition there are several features including statement cache support and job scheduler support on NT.

AM51: Adaptive Server Enterprise Internals
ASE engineering delivers a series of presentations focused on key modules of ASE including scheduler/networking, Spinlock tuning, CIS, operational scalability, migration across platforms, new XML functionalities, and more. These talks will describe the internal workings of ASE with a focus on recently added features and how they contribute to the overall reliability, operational scalability, and enterprise class performance that customers expect of ASE. Lectures are delivered by the architects and technical leads who live and breathe ASE design and implementation every day. Modules include ASE Internal/Scheduler; Business Value of Spinlock Tuning; CIS-Related Topics; Operational Scalability; New Features in ASE 12.5.2, Highlights of 12.5.1 and 12.5.0.3; Migration Across Platforms; and New XML Functionality.
techwave.sybase.com/techwave/all_sessions.stm

More Stories By John Olson

John D. Olson is a principal of Developower, Inc., a consulting company specializing in software solutions using Sybase development tools. A CPD Professional and charter member of TeamSybase, he is co-editor and author of two PB9 books, and the recipient of the ISUG Innovation and Achievement Award for 2003.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.