The SQLExecutorJob template is used to execute SQL statements and SQL procedures in a database.
- This job template makes use of JDBC connections and the Hibernate database access layer.
- This job template can be used to access any database which a JDBC Driver is available for on the Agent.
- JS7 includes a number of JDBC Drivers for supported DBMS, see the JS7 - Database article.
- For other DBMSs users can provide an individual JDBC Driver and store that Driver's .jar file in the .
/lib/user_libdirectory of the Agent installation.
- This job template supports use of a JS7 - Credential Store.
When defining the job either:
- invoke the Wizard that is available from the job properties tab in the Configuration view and select the JITL SQLExecutorJob and the relevant arguments from the Wizard
- specify the
JITLjob class and
com.sos.jitl.jobs.db.SQLExecutorJobJava class name and then add arguments as explained in the documentation below.
A SQLExecutorJob configuration can look like this:
The job's arguments can be specified as follows:
The Job Documentation including the full list of arguments can be found under: https://www.sos-berlin.com/doc/JS7-JITL/SQLExecutorJob.xml
The SQLExecutorJob class accepts the following arguments:
|Carries the SQL statements.
Specifies the configuration file (XML) format for Hibernate connections, see JS7 - Database. By default Agents ship without hibernate configuration files. However, if a file with the default name is available then it will be applied.
Raises a warning if the SQL statement creates a result set.
If stored procedures which return a result set are called then this argument has to be set to
Specifies how a result set is forwarded to order variables for subsequent jobs:
|Specifies the path to a result file if the
resultset_as_variables argument is used with one of the values
csv, xml, json. An absolute path can be specified and a relative path can be used which starts from the Agent's working directory.
|Location of a credential store database (*.kdbx)
|Location of a credential store key file (*.key)
- Note that it is possible to define more than one instruction with the
Such instructions are then carried out in the order in which they are written and must be separated by a semicolon.
- Some DBMS might require an additional newline character.
- For example:
update MY_TABLE set a='foo' where b='bar'; commit;
- Note that order variables and arguments can be injected to the SQL statement(s) of the
commandargument using the
- The SQLExecutorJob can be used with a credential store to hold sensitive arguments. For use of the
credential_store_*arguments see JS7 - Use of Credential Store with JITL Jobs.
The following operations are available:
- The cancel operation is applied to the order, not to the SQLExecutorJob. In case of cancellation the job will continue until completion and the order will be put in the failed state.
- The cancel/kill operation is applied to the order and to the job. The SQLExecutorJob will be killed, the database connection will be closed and the DBMS session will be terminated. The order will be put in the failed state.
- The DBMS decides about rolling back transactions when closing the client session.
- JS7 - JITL PLSQLJob
- JS7 - JITL SQLPLUSJob
- JS7 - JITL Common Variables
- JS7 - Job Resources
- JS7 - Use of Credential Store with JITL Jobs