![]() |
![]() ![]() October 26 31, 2003 |
![]() |
|
|
Jonathan Robie DataDirect TechnologiesJava, Databases, and XML Query Languages Many Java applications exchange data as XML, but store and query data using a JDBC connection to a traditional relational database. Unfortunately, XML and SQL represent information in very different ways. Although XML databases are now generating mainstream interest, most developers are still using relational databases. When producing XML for exchange, programmers need a way to build a hierarchical XML structure using queries on a set of unordered two dimensional tables. Similarly, they need a way to update the contents of their two dimensional tables based on the contents of hierarchical XML. Almost all major RDBMS vendors now supply tools or product enhancements to help bridge the gap between XML and relational data. The incompatible approaches they have taken are often ad hoc and inconvenient. For most Java applications, the most convenient approach is to use a query language that can query relational data and build any desired XML structure. The XML can then be returned as JDOM, SAX, DOM or text. Two emerging query language standards now make this possible. SQL/XML is an extension to the ANSI/ISO SQL standard that allows XML to be generated as the result of a query and provides an XML datatype. W3C's XQuery is a query language that takes XML as its input and produces XML as its output. Some DBMS vendors will soon allow XQuery to operate on SQL/XML views of their databases. Using these standards greatly simplifies development, provides for more maintainable code, and provides portability across databases. Java is an object oriented language; XQuery is an XML oriented language. There are several Java-based implementations of XQuery, and it can be very convenient and efficient for Java applications to delegate complex XML processing to an XQuery library, receiving results as SAX, DOM, JDOM or text. XQuery is not only a query language, but a general processing language for XML, allowing very powerful transformations to be expressed economically The basic data types used in XQuery are those found in XML documents: documents, elements, attributes, comments, processing instructions, and the built-in XML Schema types such as integer, float, double, date and string. An XML document can represent almost anything, and users of an XML query language expect it to be able to do useful queries on whatever they have stored in XML. XQuery is based on the structure of XML, and leverages this structure to provide query capabilities for the same range of data that XML represents. This presentation provides a high-level introduction to the XQuery language by presenting a series of examples which each illustrate an important feature of the language and showing how it is used in practice. We cover most of the language features of XQuery, but also focus on teaching the idioms used to solve specific kinds of problems with Xquery.
|
|||||||
* Return to Top *
© 1997 2003 Kovsky Conference Productions Inc. All rights reserved.