tags:

views:

223

answers:

3

Any idea, why none of the debugging comments are printed once after executing the ANT build script's SQL task via java code?

The java class to execute the sql in build scirpt is

public class AntRunnerTest {
   private Project project;

   public void executeTask(String taskName) {
    try {
     project = new Project();
     project.init();
     project.setBasedir(new String("."));
     ProjectHelper helper = ProjectHelper.getProjectHelper();
     project.addReference("ant.projectHelper", helper);
     helper.parse(project, new File("build-copy.xml"));
     System.out.println("Before");
     project.executeTarget(taskName);
      System.out.println("After");
    } catch(Exception ex) {
       System.out.println(ex.getMessage());
    }
   }

   public static void main(String args[]) {
    try {
     AntRunnerTest newInst = new AntRunnerTest();
     newInst.executeTask("sql");
    } catch(Exception e) { 
     System.out.println(""+e);
    }
   }
}

I dont see the debug String "After" getting printed in the console. I noticed this issue only when i try to execute a sql task using java code.

The ant script has the following simple transaction tag in it.

<transaction> <![CDATA[ select now() ]]> </transaction>

Any thoughts?

Thanks in advance.

A: 

What is the exception and is select now() valid for your DBMS?

Dave
A: 

The problem will be solved if you add the output attribute of tag.

Jay
A: 

Hi,

Sorry to interrupt but I tried the code and my program keep stuck (in infinite loop) after project.init(). Anyone have any idea why this happen?

Thanks

Iso
Please attach your <sql> tag contents.
Jay