Cernunnos Manual


<sql-datasource>

Description:

Creates a pooled DataSource and registers it as a request attribute. By default, it will be registered under SqlAttributes.DATA_SOURCE. Cernunnos SQL tasks will look for a DataSource under this name as well. In most cases, therefore, neither parent nor child tasks need specify an attribute name for the DataSource object.

Reagents:

Name XPath Description Reagent Type Expected Type Required
ATTRIBUTE_NAME @attribute-name Optional name under which the new DataSource will be registered as a request attribute. If omitted, the name 'SqlAttributes.DATA_SOURCE' will be used. PHRASE java.lang.String No
DRIVER @driver Optional JDBC driver class name to use when opening the connection. You must provide either DATA_SOURCE or DRIVER, URL, USERNAME, and PASSWORD. PHRASE java.lang.String Yes
URL @url Optional JDBC connection URL to use when opening the connection. You must provide either DATA_SOURCE or DRIVER, URL, USERNAME, and PASSWORD. PHRASE java.lang.String Yes
USERNAME @username Optional username to use when opening the connection. You must provide either DATA_SOURCE or DRIVER, URL, USERNAME, and PASSWORD. PHRASE java.lang.String Yes
PASSWORD @password Optional password to use when opening the connection. You must provide either DATA_SOURCE or DRIVER, URL, USERNAME, and PASSWORD. PHRASE java.lang.String Yes
SUBTASKS * The set of tasks that are children of this task. NODE_LIST java.util.List No

Examples:

Connects to a database using the password stored in '/C:/passwd.txt', executes the SQL statement specified by the first argument on the command line:

 
       
        <sql-datasource driver="org.hsqldb.jdbcDriver" password="${url(/C:/passwd.txt)}" url="jdbc:hsqldb:hsql://localhost:8887" username="sa"> 
          <sql-statement sql="${req($1)}"/> 
        </sql-datasource>