Command execution in runtime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vgokulraj
    New Member
    • Aug 2006
    • 7

    #1

    Command execution in runtime

    hi,

    in the following code i have a problem. While I try execute with big query?

    1. Runtime run = Runtim.getRunti m();
    2. Process p =run.exex("c:\\ script.bat");

    script.bat contains mysql command line operation for eg:
    mysql -u root databasename -e "select * from testTable"; >> c:\\test.txt

    the above simple query not make a problem. I got the file test.txt

    But when I try to add more colums and n no..of joins and some where conditions. The program executed fine but i didn't get the file test.txt.

    Any iead.
  • PLA
    New Member
    • Aug 2006
    • 44

    #2
    Originally posted by vgokulraj
    hi,

    in the following code i have a problem. While I try execute with big query?

    1. Runtime run = Runtim.getRunti m();
    2. Process p =run.exex("c:\\ script.bat");

    script.bat contains mysql command line operation for eg:
    mysql -u root databasename -e "select * from testTable"; >> c:\\test.txt

    the above simple query not make a problem. I got the file test.txt

    But when I try to add more colums and n no..of joins and some where conditions. The program executed fine but i didn't get the file test.txt.

    Any iead.
    run.exec is not synchronous, it returns before the end of your script.bat
    I don't know, maybe your prog ends before the bat?

    Comment

    • vgokulraj
      New Member
      • Aug 2006
      • 7

      #3
      Originally posted by PLA
      run.exec is not synchronous, it returns before the end of your script.bat
      I don't know, maybe your prog ends before the bat?
      I got the answer now after i used the getInputStream( ) and waitFor() methods from the Process class.

      Gokul

      Comment

      Working...