Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2013
    Location
    India
    Posts
    246

    Unanswered: DB2 ATS - shell scripts

    Hello all,

    I am using DB2 v10.1.0.0 on rhel 5.

    I want to use Administrative Task Scheduler. I know that plain SQL, some db2 commands and .sql files can be run using it.

    but can .sh (shell script files) can be scheduled in this scheduler ? If yes then how ?

    thanks in advance

    ssumit
    ssumit

  2. #2
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    Only if you code an sproc that executes the shell scripts, though that's rather a clumsy solution.
    Other options, code java sprocs to do the work (instead of writing in shell script), or if you must use shell scripts for some reason then schedule with cron or with an enterprise-scheduling-tool if your site uses such a thing.

  3. #3
    Join Date
    Sep 2013
    Location
    India
    Posts
    246
    Thanks db2mor,

    You are right.

    The scenario is, our OS is overburdened with cron entries. we wan to shift some cron jobs to db scheduler. Existing cron jobs are actually java sprocs in a .sh file.

    Converting all them to DB2 sprocs will be very time taking. So i asked the Question.

    Any other alternatives ?

    thanks in advance

    ssumit
    ssumit

  4. #4
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hi,

    Have a look at IBM Data Studio web console.
    You can download it from here: Data Studio Web Console.
    Regards,
    Mark.

  5. #5
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    if the shell scripts already invoke sprocs , what stops you from invoking those same sprocs from ATS ? any non-sproc logic in those shell scripts would need recoding appropriately, which may require wrapper sprocs.

  6. #6
    Join Date
    Sep 2013
    Location
    India
    Posts
    246
    thanks db2mor.

    "Only if you code an sproc that executes the shell scripts, though that's rather a clumsy solution."

    as per your statement above in the same thread earlier (i agree with this).

    i am trying below strategy..

    Compile the java program:
    1. dsc_expiry_update.java
    javac dsc_expiry_update.java

    2. Create a jar file:
    jar cvf dsc_expiry_update.jar dsc_expiry_update.class

    3. Register the jar file with DB2:
    DB2_INSTALL_JAR"("file://datahome/db2inst1/procedures/dsc_expiry_update.jar", "test_dsc",0)"


    4. Trying to create a external db2 procedure calling this jar.

    CREATE PROCEDURE EPROC.TEST_DSC_PROC()
    SPECIFIC TEST_DSC_PROC
    DYNAMIC RESULT SETS 0
    DETERMINISTIC
    LANGUAGE JAVA
    PARAMETER STYLE JAVA
    NO DBINFO
    THREADSAFE
    MODIFIES SQL DATA
    PROGRAM TYPE SUB
    EXTERNAL NAME 'dsc_expiry_update!dsc_expiry_update'
    ;

    Please suggest is this approach is better ?

    Also i am getting error at step 4 above (already posted in forum "Sub: java sp in db2 procedures - error")

    thanks in advance.

    ssumit
    ssumit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •