The MySQL tools in Stylus Studio can greatly simplify XML related development tasks for working with MySQL and XML:

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

For accessing and updating MySQL from XQuery from inside a Java program, use DataDirect XQuery, a Java based component that supports querying and updating MySQL database tables using the W3C XQuery language, simplifying working with relational and XML data from within Java programs.

1. XQuery with MySQL Enterprise and MySQL Community Editions

Since MySQL does not have a native XQuery engine, the DataDirect XQuery™ embeddable XQuery engine provides the perfect solution. Since the XQuery parser is layered directly onto the database drivers, there is no middleman to introduce latency into the query process.

DataDirect XQuery™ also lets you combine relational queries with XML data and even non-XML data such as EDI, through intergration with the DataDirect XML Converters™.

Using the File Explorer, it's quick and painless to add a new reference to a MySQL data source. Just right-click on Relational DB and choose New Server. Populate the dialog with the login information, like this:

And you can just drag the sources of data from the panel onto the editing surface to create a new collection. Our example here is using a MySQL instance running on a machine named stylus.

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

Once you've connected to the database, it is a simple matter to use this data source for creating reporting, as the next point shows.

These queries are very powerful, because they take advantage of the underlying optimizations of the database engine. Hundreds of database professionals with a deep understanding of query optimization have added together their brainpower to give MySQL the low-latency high-performance reputation it has.

DataDirect works closely with open source database groups and their related vendors, including MySQL AB, to determine exactly which queries will produce the highest performance. When you write your XQuery, it is decomposed and analyzed, and SQL 'tweaked' and tuned for MySQL is what is sent through the database driver.

Just because MySQL doesn't offer XQuery doesn't mean that you have to do without. And since DataDirect XQuery™ is fully W3C XQuery compliant, even if you do decide to switch our your underlying database engine for some other engine, your application doesn't have to change. Using DataDirect XQuery™ will ensure that whether you are using MySQL 5 or a future version or something else entirely, your query will be insulated from changes and simultaneously will take advantage of whatever optimizations are available on the underlying platform.

XQueries don't just have to stand alone; they can also be embedded in XML Pipelines for multi-stage extractions and transformations.

2. Publishing from MySQL

Just dragging the MySQL 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 generate XSLT 1.0, XSLT 2.0 or XQuery 1.0 that will in turn generate HTML+CSS or XSL-FO. You can then use that generated code in your own applications, or as part of an XML Pipeline to accomplish more complicated operations.

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

Discover exactly how much power is at your disposal by combining XQuery and MySQL by downloading and trying out the Stylus Studio® MySQL XQuery tools today!

Free Stylus Studio XML Training: