Warning

This page seems to be no longer up to date. It needs a rework.

XSQL is Oracle's tool for turning SQL queries into XML or for taking XML and insert/updating it into a database. This can be a handy tool when you wish to either enrich or expose SQL data to an ESB or extract part of an XML document and persist it into a database.

Note that XSQL is quite simple, but useful. If you want something more complex and powerful you might want to look at using a scripting language like Groovy.

Example XSQL document

Firstly here is an example XSQL document. As you can see its a piece of XML which allows embedded SQL statements inside it.

{snippet:id=xsql|lang=xml|url=servicemix/smx3/trunk/sandbox/core/src/test/resources/org/servicemix/components/xsql/example.xsql}

This example page could produce something like...

xml <food> <cheese num="1"> <id>1.00</id> <name>Edam</name> </cheese> <cheese num="2"> <id>2.00</id> <name>Cheddar</name> </cheese> <cheese num="3"> <id>3.00</id> <name>Brie</name> </cheese> </food>

Then we can convert this into a JBI component and apply it in a pipeline as follows...

{snippet:id=xsql|lang=xml|url=servicemix/smx3/trunk/sandbox/core/src/test/resources/org/servicemix/components/xsql/example.xml}

There are 2 main modes of operation for this component