Sybase IDE, Sybase Tools

Sybase Tools

Sybase Adaptive Server Enterprise (henceforth, Sybase ASE) as of this writing supports similar levels of XML utility in both versions 12.5.4 and 15.0.1. Although the indexing of stored XML documents is quite sophisticated and the engine is mature, the facility for querying that data hasn't been significantly enhanced in several years.

The two primary methods are SQLJ, which is similar to the SQL/XML standard, and XQL, which is similar to SQLJ, but not enough to share code. The former is supported in the Sybase SQL engine, and the latter in the Java interface.

Stylus Studio® provides advanced Sybase tools and support for current XML querying technologies with the powerful and stable Sybase ASE server. Using the two together will provide support for XQuery, allowing modern standards to work with a modern query engine. This tutorial covers some of the tools for working with Sybase in Stylus Studio®:

  1. Writing, testing and debugging XQuery
  2. Publishing directly from the database

1. XQuery with Sybase ASE Server

Stylus Studio® provides full support DataDirect XQuery™ (an XQuery processing component), which you can use to access the Sybase data store with XQuery.

Going further, while Sybase alone allows you to query across XML and relational data without prejudice, Stylus Studio® allows you to merge in non-XML sources of data as well — including EDI and other flat files, through support of DataDirect XML Converters™. Although at first this may resemble the Sybase EDI Server product line, there are two important distinctions. The XML Converters run in-process, as part of your application. There is no need for a separate server. Since they are part of your process, you control the scheduling and message queuing.

In order to reach the Sybase data store, simply add a new reference to the chosen Sybase database through the File Explorer. Just right-click on Relational DB and choose New Server. Populate the dialog with the login information, like this:

And you can just drag and drop your connections onto the editing area to define a new collection. Our example here is using an Sybase 12.5 server running on a machine named stylus.

XQuery against Sybase (Click to enlarge)
(click to enlarge)

The way that XQuery against a relational database works is that the query is parsed and rewritten according to the SQL dialect of the underlying engine. This allows you to take advantage of the underlying optimizations of the database engine. If the engine is upgraded — for example, you move from Sybase ASE 12.5 to Sybase ASE 15.0 — the driver will see this and automatically choose the most appropriate optimizations. This saves you from having to change your code, and insulates you from vendor syntax changes.

DataDirect works hand-in-hand with database vendors including Sybase to determine exactly which queries results in the fastest performance. When you execute your XQuery, a carefully constructed query is issued to the database.

Using DataDirect XQuery™ will ensure that whether you are using Sybase 12.x or Sybase 15.x or (someday maybe) Sybase 20.x, your query can go on living quietly inside your application, with full confidence that it is protected from the sometimes overwhelming vagaries and complexities of query tuning.

And we're not in this to tune SQL, but to actually produce useful answers. Two facilities in Stylus Studio® which can aid you are:

Publishing. Once you've connected to the database, it is a simple matter to use this database for XML reporting or publishing, as you'll see shortly.

Pipelines. XQueries don't just have to stand alone; they can also be embedded in XML Pipelines for multi-stage extractions and transformations — mixing XSLT, XQuery, validation, conditional logic — all in one atomic bundle.

2. Publishing from Sybase

Just dragging the Sybase JDBC Entry from the File Explorer to the XML Report data sources pane makes it available for use in publishing from XML.

The XML Report module lets you draw your output on the screen, and then builds XSLT 1.0, XSLT 2.0 or XQuery 1.0 that will in turn output HTML+CSS or XSL-FO. You can then use that built code in your own programs, or as part of an XML Pipeline to accomplish more complicated operations.

See demonstrations and read more about the features of the XML Publisher module by following this link.

Download a copy of Stylus Studio® now, and use it along side of your copy of Sybase. You'll find they compliment each other extremely well, as you yourself can see by downloading a free trial of our Sybase tools today.

Free Stylus Studio XML Training: