Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 23 Next »

This job is used as a standalone solution or triggered by orders to execute statements in a database.
These can be database procedures or SQL statements.

The description JobSchedulerManagedDatabaseJob.xml is stored in the ./jobs directory of your Job Scheduler installation.

The SQL instructions are written in the command parameter.
It is possible to define more than one instruction in the command parameter.
Such instructions are then carried out in the order in which they are written and must be separated by a semicolon and a subsequent new line.

You can use 
 as newline.

The following is an example of a job chain in which the command contains two statements separated by 
.

The job chain launchDB.job_chain.xml:

 <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job_chain.xml job_chain] orders_recoverable="yes" visible="yes">
     <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job_chain_node.xml job_chain_node] state="launch"  job="launchDB" next_state="success" error_state="error"/>
     <job_chain_node state="success"/>
     <job_chain_node state="error"/>
 </job_chain>

The order launchDB,updateMyTable.order.xml:
It contains an update statement and a commit.

 <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/order.xml order] title="update MY_TABLE">
     <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/params.xml params]>
         <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]name="command"        value="update MY_TABLE set a='foo' where b='bar';&amp;#10;commit;"/>
     </params>
     <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/run_time.xml run_time]/>
      </order>

The job launchDB.job.xml: It executes the statements.

 <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job.xml job] title="Launch Database Statement" order="yes" stop_on_error="no">
     <description>
        <include file="jobs/JobSchedulerManagedDatabaseJob.xml"/>
    </description>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/params.xml params]>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]name="db_class"        value="SOSMySQLConnection"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]name="db_driver"       value="com.mysql.jdbc.Driver"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]name="db_url"          value="jdbc:mysql://localhost:3306/scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]name="db_user"         value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]name="db_password"     value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]name="command"         value=""/>
    </params>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/script.xml script ]language="java" java_class="sos.scheduler.managed.JobSchedulerManagedDatabaseJob"/>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/run_time.xml run_time]/>
 </job>
  • No labels
Write a comment…