slamb.org / projects / axamol  

Axamol SQL Library

Axamol SQL Library executes SQL statements stored in external library files from Java code, with named parameters. Separating SQL and Java code increases readability, eases maintenance, and allows separate testing and documentation.

A statement looks like this:

<s:query name="get_emp">
  <s:param name="name" type="string"/>

  <s:sql databases="oracle">
    select    *
    from      scott.emp
              join scott.dept on (emp.deptno = dept.deptno)
    where     emp.ename = <s:bind param="name"/>
  </s:sql>
</s:query>

and is executed with code like this:

LibraryConnection lc = ...;
ResultSet rs = null;
try {
    Map params = new HashMap();
    params.put("name", "SMITH");
    rs = lc.executeQuery("get_emp", params);
    while (rs.next()) {
        ...
    }
} finally {
    SqlUtils.close(rs);
}

Axamol SQL Library can often reduce code size of complex queries by 40%. See the Advantages section of the user manual for a "before and after" of such an example.

You can also create HTML documentation with embedded documentation strings and a supplied XSLT stylesheet. For example, this library (hit "View Source" for a better view) produces this documentation automatically.

This project used to be called xmldb. If you came here looking for that, you're in the right place.

Documentation

Downloads

Version 0.1.4 (released 14 Jun 2005):

What related products are out there?

I've found a few products that fill the same general role:

Future directions