Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003
    Posts
    3

    Unanswered: How to execute a Dos Batch file with DB2 Stored Procedure in Windows?

    I need to execute a dos batch file by calling a stored procedure in DB2 on Windows.

    In MS SQL one can use the extended stored procedure xp_cmdshell 'c:\test.bat'.

  2. #2
    Join Date
    May 2002
    Location
    VA,USA
    Posts
    8

    Re: How to execute a Dos Batch file with DB2 Stored Procedure in Windows?

    Originally posted by jacobm
    I need to execute a dos batch file by calling a stored procedure in DB2 on Windows.

    In MS SQL one can use the extended stored procedure xp_cmdshell 'c:\test.bat'.
    You need to make another stored prodeure in 'C' which will in turn execute your dos batch program.
    First you can try out a C making program and executing it , then U can reference it to a stored procedure.
    regards,
    Arvind

  3. #3
    Join Date
    Feb 2003
    Posts
    3

    Re: How to execute a Dos Batch file with DB2 Stored Procedure in Windows?

    Originally posted by arvind_tcs
    You need to make another stored prodeure in 'C' which will in turn execute your dos batch program.
    First you can try out a C making program and executing it , then U can reference it to a stored procedure.
    regards,
    Arvind
    Hi Arvind,

    I have created a java procedure

    import java.io.*;
    import java.util.*;
    import java.math.*;

    public class callbatchfile
    {
    static String cmdstr;

    /**********************************/
    /* MAIN Method */
    /*********************************/
    public static void main(String args[]) throws IOException
    {
    cmdstr = args[0] + " " + args[1];
    System.out.println(cmdstr);
    Runtime r=Runtime.getRuntime();
    Process P = r.exec(cmdstr);
    }
    }

    it works well from the command line. I have then created a stored procedure but for some reason I am not bale to call it.

    Can you assist please?

Posting Permissions

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