Download Stylus Studio - The World's Best XML Development Environment!


DataDirect Connect for SQL/XML is your solution for producing XML for data exchange.

See:
          Description

Packages
com.ddtek.jdbc.jxtr

The com.ddtek.jdbc.jxtr package implements the JDBC 3.0 interfaces for the Connect for SQL/XML JDBC driver, which is used to process the result set returned from a SQL/XML query and create a SQL/XML data source.

com.ddtek.jxtr
The com.ddtek.jxtr package implements the classes and interfaces required to process and execute jXTransformer queries and write statements.

 

DataDirect Connect for SQL/XML is your solution for producing XML for data exchange. Connect for SQL/XML lets Java applications connect to databases using DataDirect Technologies JDBC drivers, return XML values in the columns of JDBC result sets, and access XML columns as JDOM, SAX, DOM, or text.

DataDirect Connect for SQL/XML contains the following components:

For details about using Connect for SQL/XML, refer to the information in this Javadoc and the Connect for SQL/XML User's Guide.


DataDirect Connect for SQL/XML

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, and many developers spend significant effort converting information between the two.

When producing XML for data exchange, developers need a way to build hierarchical XML structures using queries on a set of unordered two-dimensional tables. Similarly, they need a way to update the content of their two-dimensional tables using data in XML hierarchies.

Almost all major RDBMS vendors now supply tools or product enhancements to help bridge the gap between XML and relational data. Unfortunately, their proprietary approaches are incompatible and are often ad hoc or awkward. A better, standards-based approach now exists. SQL/XML is an extension to the ANSI/ISO SQL standard that allows XML to be generated as the result of a query, and adds an XML data type to SQL so that XML query results can be returned in columns of normal SQL result sets. The final draft of SQL that includes these extensions is expected in mid-2003. Using standard SQL/XML instead of proprietary vendor extensions simplifies development, provides for more maintainable code, and provides portability across databases.

For most Java applications that need to exchange data in XML, the most efficient approach is to use SQL/XML to query relational data and build the appropriate XML structure. For example, suppose your company uses data stored in an Oracle database for billing purposes. You may want to make available some of the same data over your company’s Intranet for project planning purposes. Using Connect for SQL/XML, you can create Connect for SQL/XML queries to structure that information any way you want it in the returned result set or XML. You can create one Connect for SQL/XML query that lists each project by employee and their billable hours, and you can create another Connect for SQL/XML query that lists each employee by their project assignment and billable hours.

DataDirect Connect for SQL/XML lets Java applications connect to databases using DataDirect Technologies JDBC drivers, return XML values in the columns of JDBC result sets, and access XML columns as JDOM, SAX, DOM, or text. This makes it easy to write applications that work without change for any database that DataDirect Technologies JDBC drivers support.

Currently, the SQL/XML standard supports queries, but not updates. DataDirect Technologies is a member of the H2.3 Task Group that is responsible for SQL/XML. We hope that updates will be added to the standard; in the meantime, Connect for SQL/XML provides proprietary extensions to the SQL99 Insert, Update, and Delete statements that allow you to update data stored in relational databases with information extracted from XML.

DataDirect Connect for SQL/XML was originally introduced as DataDirect jXTransformer, which used a query language derived from the same paper that inspired SQL/XML. DataDirect Technologies is committed to supporting standards, so we have renamed the product to clearly convey our support for SQL/XML. The older, proprietary language and API are still available, and are particularly useful for updates. As SQL adds this functionality to the standard, we will provide it in our SQL/XML implementation. As a member of the SQL/XML task group, DataDirect Technologies wants the standard to cover all functionality required for common applications, allowing you to build your applications using standards-based components.


Connect for SQL/XML Queries

DataDirect Connect for SQL/XML supports two types of queries:  

·        SQL/XML queries return JDBC result sets that can contain XML values. SQL/XML queries must be executed through the Connect for SQL/XML JDBC driver (the SQL/XML JDBC driver). SQL/XML is an extension to the ANSI/ISO SQL standard.

·        jXTransformer queries return XML results in the form of an XML document, a JDBC result set, or directly to your Java application. Typically, jXTransformer queries are executed through the proprietary jXTransformer API, but they also can be executed through the Connect for SQL/XML JDBC driver.
 


jXTransformer Write Statements

To write data stored in XML documents to relational databases, you create jXTransformer write statements (Insert, Update, and Delete statements). jXTransformer write statements allow you to perform the following tasks:

·        jXTransformer Insert statements insert data from an XML document into new rows in relational database tables.

·        jXTransformer Update statements update data in relational database tables with data from an XML document.

·        jXTransformer Delete statements delete data in a relational database table. The rows that are deleted are specified by a Where clause in the jXTransformer Delete statement.
 


SQL/XML or jXTransformer?

We recommend that you use SQL/XML when you can. You may find, however, that the current SQL/XML extensions to the SQL standard do not contain the functionality that you need. In these cases, we still support our older jXTransformer language because many developers need to perform updates or to create processing instructions, CDATA Sections, comments, or DOCTYPEs in the results of queries. In the future, we hope that this functionality will all be available as part of the SQL standard.

Both SQL/XML and jXTransformer queries support the following features:

·        Read access to any relational database supported by DataDirect Technologies JDBC drivers

·        Support for constructing XML typed values based on relational data

·        Creation of XML structures based on standard JDBC result sets

·        DataDirect Query Builder for SQL/XML, which is a GUI tool that allows you to quickly create, modify, and test Connect for SQL/XML queries without having to know the details of the query syntax

·        JAXP 1.2, DOM level 2, JDOM 1.0 Beta 7, SAX 2.0.1, writer object interfaces, and XPath 1.0

·        Parameter markers, SQL Select expressions, and JDBC scalar functions within Connect for SQL/XML queries

·        Reuse of prepared statements, batch updates, and other performance-enhancing techniques

The following list describes the features provided by jXTransformer statements that are not provided by SQL/XML queries:

·        Write access to any relational database supported by DataDirect Technologies JDBC drivers

·        Native XML results (transforming into XML from result sets is not required)

·        Full support for XML, including:

·        DTDs, XML schemas, and namespaces

·        CDATA sections

·        Comments in the XML document header

·        Document-level processing instructions, such as the specification of XSL stylesheets



Stylus Studio features SQL/XML tools for building XML views of relational data.