Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Deprecation notice added

Table of Contents
outlinh1. true
outlinh1. true
1printablefalse
2stylh1. none
3indent20px

JITL: The Managed Database Job

Info
titleImportant

This job uses the deprecated sos.scheduler.managed.JobSchedulerManagedDatabaseJob that has been deprecated with Release 1.12.

The JobSchedulerManagedDatabaseJobSOSHibernate job is

...

provided as an alternative.

This job is used to execute (SQL-)statements in a database and can be used standalone or triggered by orders - i.
These can be e. as an order job.
It can execute database procedures or SQL statements.

(A general overview of all JITL jobs can be found Library of Standard Jobs - JITL).

The description JobSchedulerManagedDatabaseJob.xml is stored in the ./jobs directory of your Job Scheduler the JobScheduler 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.

...

The job chain launchDB.job_chain.xml:

Code Block
  <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job_chain.xml job_chain] <job_chain orders_recoverable="yes" visible="yes">
     <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job<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.

Code Block
  <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/order.xml order] <order title="update MY_TABLE">
     <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/params.xml params]><params>
          <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<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]<run_time/>
      </order>

The job launchDB.job.xml (i.e. with a MySQL database connection, examples for other DBMS see below): It executes the statements where the statement in the order command parameter overwrites the statement in the job command parameter.

...

MySQL (MariaDB)

Code Block
  <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job.xml job] <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]><params>
         <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_class"        value="SOSMySQLConnection"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_driver"       value="com.mysql.jdbc.Driver"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_url"          value="jdbc:mysql://localhost:3306/scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_user"         value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_password"     value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="command"         value=""/>
    </params>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/script.xml script ]<script language="java" java_class="sos.scheduler.managed.JobSchedulerManagedDatabaseJob"/>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/run_time.xml run_time]<run_time/>
 </job>

For other database management systems you have to modify the connection parameter like in the following examples:

MS

...

SQL

...

Server

Code Block
  <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job.xml job] <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]><params>
         <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_class"        value="SOSMSSQLConnection"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_driver"       value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_url"          value="jdbc:sqlserver://localhost:1433;sendStringParametersAsUnicode=false;selectMethod=cursor;databaseName=scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_user"         value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_password"     value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="command"         value=""/>
    </params>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/script.xml script ]<script language="java" java_class="sos.scheduler.managed.JobSchedulerManagedDatabaseJob"/>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/run_time.xml run_time]<run_time/>
 </job>

Oracle

Code Block
  <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job.xml job] <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]><params>
         <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_class"        value="SOSOracleConnection"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_driver"       value="oracle.jdbc.driver.OracleDriver"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_url"          value="jdbc:oracle:thin:@localhost:1521:scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_user"         value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="db_password"     value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]<param name="command"         value=""/>
    </params>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/script.xml script ]<script language="java" java_class="sos.scheduler.managed.JobSchedulerManagedDatabaseJob"/>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/run_time.xml run_time]/>
 <run_time>
 </job>

see See also:

PostGres

...

PostgreSQL

Code Block
<job title="Launch Database Statement" order="yes" stop_on_error="no">
     <description>
        	<description>
		<include file="jobs/JobSchedulerManagedDatabaseJob.xml"/>
    	</description>
	<params>
   <[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 ]		<param name="db_class"        		 value="SOSPgSQLConnection"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]		<param name="db_driver"       		 value="org.postgresql.Driver"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]		<param name="db_url"          		 value="jdbc:postgresql://localhost:5432/scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]		<param name="db_user"         		 value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]		<param name="db_password"	     value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]		<param name="command"         		 value=""/> 
   	</params>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/script.xml script ]	<script language="java" java_class="sos.scheduler.managed.JobSchedulerManagedDatabaseJob"/> 
   <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/run_time.xml run_time]/>
 	<run_time>
</job>

 

IBM/DB2

Code Block

 <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job.xml job] <job title="Launch Database Statement" order="yes" stop_on_error="no">
     <description>
        	<description>
		<include file="jobs/JobSchedulerManagedDatabaseJob.xml"/>
    	</description>
	<params>
   <[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 ]		<param name="db_class"        		value="SOSDB2Connection"/> 
       <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]		<param name="db_driver"       		value="com.ibm.db2.jcc.DB2Driver"/> 
       <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]		<param name="db_url"          		value="jdbc:db2://localhost:50000/scheduler:driverType=2;retrieveMessagesFromServerOnGetMessage=true;"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]		<param name="db_user"         		value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]		<param name="db_password"     	value="scheduler"/>
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/param.xml param ]		<param name="command"         		value=""/>
    	</params>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/script.xml script ]	<script language="java" java_class="sos.scheduler.managed.JobSchedulerManagedDatabaseJob"/> 
   <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/run_time.xml run_time]/>
 	<run_time>
</job>