Skip to content

Sql Script Runner support

Summer.Batch.Extra.SqlScriptSupport.SqlScriptRunnerTasklet is dedicated to launch an external SQL script.

Two below properties are mandatory: as usual for SQL processes, a ConnectionStringSettings must be supplied, and the resource to be read (i.e. the script file) must also be supplied.

  • ConnectionStringSettings

  • the resource to be read (i.e. the script file) must also be supplied.

Configuring the SqlScriptRunnerTasklet in the job XML file:

Example 7.16. Typical SqlScriptRunnerTasklet usage in the job XML file

<step id="SQLScriptWriter">
    <batchlet ref="SQLScriptWriterBatchlet" />
</step>

Example 7.17. Sample Unity configuration for a SqlScriptRunnerTasklet


// Step SQLScriptWriter - SQL script step
private void RegisterSQLScriptWriterTasklet(IUnityContainer container)
{
    container.StepScopeRegistration<ITasklet, SqlScriptRunnerTasklet>("SQLScriptWriterBatchlet")
        .Property("ConnectionStringSettings").Reference<ConnectionStringSettings>("Default")
        .Property("Resource").Resource("#{settings['BA_SQLScriptWriter.SQLScriptWriter.FILENAME']}")
        .Register();
}