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.

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

This example page could produce something like...

<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...

Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20

There are 2 main modes of operation for this component

  • you explicitly specify the XSQL page to use inside the component when it is invoked. This is useful if you wish to requery a database at timed intervals for example and publish the XML content
  • the inbound XML content is assumed to be an XSQL page which is then evaluated against its database. This allows you to send an XSQL page to this component to be evaluated.