ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srinivasan Ranganathan <>
Subject Running DB2 scripts from a shell
Date Mon, 01 Nov 2004 03:11:34 GMT

I have a DB2 script that creates a database. I'd like my build to drop
and recreate the db everytime. To run the DB2 script, I need to setup
the environment for it beforehand. I have this working well. The issue
is that to run the DB2 script, I need to run a batch file which opens
a new shell. I have a target like so...

    <target name="create-db" depends="init">
        <!-- Drops the existing db and creates a new one without any tables -->
        <exec executable="${db2.home}/bin/${db2.command}">
            <arg value="${db2.commandline.arg1}"/>
            <arg value="${db2.commandline.arg2}"/>
            <arg value="${db2.command.options}"/>
            <arg value="${db.create.script}"/>

At this point, I want to create some tables (which I do with the sql
task). Since the create script runs in a separate shell, the target
returns immediately even if the db is still being created. So
subsequent tasks fail.

I want the create-db target to complete only after the db has been
created. I accomplished this by sleeping for a few mintues. But this
isn't a good solution. I looked at the waitfor task. I could use it
with the istrue condition and set a property to true if the connection
succeeds. The problem with this is, how do I set the property? I could
use the sql task to do a simple connection. But from the docs, I don't
failureproperty for the sql task.

Thanks in advance.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message