You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Joe McGlynn <mc...@onetouch.com> on 2000/12/30 17:54:05 UTC

Ant target using "java" to create PointBase db

This is a tough question to ask succinctly, so please bear with me.

I want to use Ant to automate my builds, which include creating a new SQL
database instance using PointBase (a commercial Java-based ORDBMS).  They
have a command line utility that will create an "empty" db and execute a SQL
script (to create tables and so forth).  I have done this via a DOS BAT
file, so I'm sure this part works.

I get as far as the PointBase tool creating the new empty database, but it
never runs the script.  The name of the script is an argument to the
PointBase utility, which must see all of the other parameters just fine.  At
this point I am using Ant from within netbeans IDE.

I'm attaching the Ant code below, any suggestions would be hugely
appreciated.  (I know the classpath here is not done in a very nice way, but
this is just scaffolding to get this part of the build to work, I'll figure
out how to get Ant to not rely on fixed -CP later)

TIA,
Joe

================

<?xml version="1.0"?>

<!--*********************************************************-->
<!-- Ant build routine for SW Process project SQL database   -->
<!-- developed by Joe McGlynn, 12/26/00                      -->
<!-- all rights reserved, distributable under GPL            -->
<!--*********************************************************-->

<project name="build_database" basedir="." default="all">

    <!--*********************************************************-->
    <!-- define global properties for this build step            -->
    <!--*********************************************************-->
    <property name="src.sql" value="${basedir}\dbsource.sql"/>
    <property name="dbtarget" value="d:\pb\network\databases"/>
    <property name="DBNAME" value="swproc"/>
    <property name="dba.uid" value="public"/>
    <property name="dba.pwd" value="public"/>

    <target name="init">
        <tstamp/>
        <echo message="Begining  database creation on ${TODAY} at
${TSTAMP}"/>
        <echo message="executing from ${basedir}"/>
    </target>

    <target name="all" depends="init, MakeSchema">
        <!-- <echo message="Hello ${world}!"/> -->
    </target>

    <!--*********************************************************-->
    <!-- Use the PointBase commander utility                     -->
    <!-- to create an empty database                             -->
    <!-- and populate it with application tables                 -->
    <!--*********************************************************-->
    <target name="MakeSchema" depends="init">
        <echo message="begining target MakeSchema at ${TSTAMP} using
${src.sql}"/>
        <java classname="com.pointbase.tools.toolsCommander" fork="true">
            <classpath>
                <pathelement
location="D:\pb\client\classes\pbtools34GA.jar"/>
                <pathelement
location="D:\pb\client\classes\pbclient34GA.jar"/>
                <pathelement location="D:\pb\client"/>
            </classpath>
            <arg value="com.pointbase.jdbc.jdbcUniversalDriver" />
            <arg value="jdbc:pointbase://localhost/${DBNAME},new ${src.sql}"
/>
            <arg value="${dba.uid} ${dba.pwd}" />
        </java>
        <echo message="completed target MakeSchema at ${TSTAMP} using
${src.sql}"/>
    </target>


</project>


RE: Ant target using "java" to create PointBase db

Posted by Joe McGlynn <mc...@onetouch.com>.
Perfect, this was the solution!

Merci,
Joe


-----Original Message-----
From: Stéphane Bailliez [mailto:sbailliez@imediation.com]
Sent: Saturday, December 30, 2000 4:24 PM
To: ant-user@jakarta.apache.org; mcglynn@onetouch.com
Subject: Re: Ant target using "java" to create PointBase db


I don't really know what is your problem..but there should be one in your
command line.
If you have spaces in a value property they will be quoted. For example:
<jvmarg value="classic -Xmx=64M"/> -->  java "-classic -Xmx=64M" : NOT
CORRECT

<jvmarg line="classic -Xmx=64M"/> -->  java -classic -Xmx=64M

<jvmarg value="classic"/>
<jvmarg value="-Xmx=64M"/> -->  java -classic -Xmx=64M

thus I think the following:

<arg line="jdbc:pointbase://localhost/${DBNAME},new ${src.sql} ${dba.uid}
${dba.pwd}" />

should be better than what you have.

Hope it helps.

--
Stephane Bailliez
Software Engineer, Paris - France
iMediation - http://www.imediation.com
Disclaimer: All the opinions expressed above are mine and not those from my
company.


----- Original Message -----
From: "Joe McGlynn" <mc...@onetouch.com>
To: <an...@jakarta.apache.org>
Sent: Saturday, December 30, 2000 5:54 PM
Subject: Ant target using "java" to create PointBase db


> This is a tough question to ask succinctly, so please bear with me.
>
> I want to use Ant to automate my builds, which include creating a new SQL
> database instance using PointBase (a commercial Java-based ORDBMS).  They
> have a command line utility that will create an "empty" db and execute a
SQL
> script (to create tables and so forth).  I have done this via a DOS BAT
> file, so I'm sure this part works.
>
> I get as far as the PointBase tool creating the new empty database, but it
> never runs the script.  The name of the script is an argument to the
> PointBase utility, which must see all of the other parameters just fine.
At
> this point I am using Ant from within netbeans IDE.
>
> I'm attaching the Ant code below, any suggestions would be hugely
> appreciated.  (I know the classpath here is not done in a very nice way,
but
> this is just scaffolding to get this part of the build to work, I'll
figure
> out how to get Ant to not rely on fixed -CP later)
>
> TIA,
> Joe
>
> ================
>
> <?xml version="1.0"?>
>
> <!--*********************************************************-->
> <!-- Ant build routine for SW Process project SQL database   -->
> <!-- developed by Joe McGlynn, 12/26/00                      -->
> <!-- all rights reserved, distributable under GPL            -->
> <!--*********************************************************-->
>
> <project name="build_database" basedir="." default="all">
>
>     <!--*********************************************************-->
>     <!-- define global properties for this build step            -->
>     <!--*********************************************************-->
>     <property name="src.sql" value="${basedir}\dbsource.sql"/>
>     <property name="dbtarget" value="d:\pb\network\databases"/>
>     <property name="DBNAME" value="swproc"/>
>     <property name="dba.uid" value="public"/>
>     <property name="dba.pwd" value="public"/>
>
>     <target name="init">
>         <tstamp/>
>         <echo message="Begining  database creation on ${TODAY} at
> ${TSTAMP}"/>
>         <echo message="executing from ${basedir}"/>
>     </target>
>
>     <target name="all" depends="init, MakeSchema">
>         <!-- <echo message="Hello ${world}!"/> -->
>     </target>
>
>     <!--*********************************************************-->
>     <!-- Use the PointBase commander utility                     -->
>     <!-- to create an empty database                             -->
>     <!-- and populate it with application tables                 -->
>     <!--*********************************************************-->
>     <target name="MakeSchema" depends="init">
>         <echo message="begining target MakeSchema at ${TSTAMP} using
> ${src.sql}"/>
>         <java classname="com.pointbase.tools.toolsCommander" fork="true">
>             <classpath>
>                 <pathelement
> location="D:\pb\client\classes\pbtools34GA.jar"/>
>                 <pathelement
> location="D:\pb\client\classes\pbclient34GA.jar"/>
>                 <pathelement location="D:\pb\client"/>
>             </classpath>
>             <arg value="com.pointbase.jdbc.jdbcUniversalDriver" />
>             <arg value="jdbc:pointbase://localhost/${DBNAME},new
${src.sql}"
> />
>             <arg value="${dba.uid} ${dba.pwd}" />
>         </java>
>         <echo message="completed target MakeSchema at ${TSTAMP} using
> ${src.sql}"/>
>     </target>
>
>
> </project>


Re: Ant target using "java" to create PointBase db

Posted by Stéphane Bailliez <sb...@imediation.com>.
I don't really know what is your problem..but there should be one in your
command line.
If you have spaces in a value property they will be quoted. For example:
<jvmarg value="classic -Xmx=64M"/> -->  java "-classic -Xmx=64M" : NOT
CORRECT

<jvmarg line="classic -Xmx=64M"/> -->  java -classic -Xmx=64M

<jvmarg value="classic"/>
<jvmarg value="-Xmx=64M"/> -->  java -classic -Xmx=64M

thus I think the following:

<arg line="jdbc:pointbase://localhost/${DBNAME},new ${src.sql} ${dba.uid}
${dba.pwd}" />

should be better than what you have.

Hope it helps.

--
Stephane Bailliez
Software Engineer, Paris - France
iMediation - http://www.imediation.com
Disclaimer: All the opinions expressed above are mine and not those from my
company.


----- Original Message -----
From: "Joe McGlynn" <mc...@onetouch.com>
To: <an...@jakarta.apache.org>
Sent: Saturday, December 30, 2000 5:54 PM
Subject: Ant target using "java" to create PointBase db


> This is a tough question to ask succinctly, so please bear with me.
>
> I want to use Ant to automate my builds, which include creating a new SQL
> database instance using PointBase (a commercial Java-based ORDBMS).  They
> have a command line utility that will create an "empty" db and execute a
SQL
> script (to create tables and so forth).  I have done this via a DOS BAT
> file, so I'm sure this part works.
>
> I get as far as the PointBase tool creating the new empty database, but it
> never runs the script.  The name of the script is an argument to the
> PointBase utility, which must see all of the other parameters just fine.
At
> this point I am using Ant from within netbeans IDE.
>
> I'm attaching the Ant code below, any suggestions would be hugely
> appreciated.  (I know the classpath here is not done in a very nice way,
but
> this is just scaffolding to get this part of the build to work, I'll
figure
> out how to get Ant to not rely on fixed -CP later)
>
> TIA,
> Joe
>
> ================
>
> <?xml version="1.0"?>
>
> <!--*********************************************************-->
> <!-- Ant build routine for SW Process project SQL database   -->
> <!-- developed by Joe McGlynn, 12/26/00                      -->
> <!-- all rights reserved, distributable under GPL            -->
> <!--*********************************************************-->
>
> <project name="build_database" basedir="." default="all">
>
>     <!--*********************************************************-->
>     <!-- define global properties for this build step            -->
>     <!--*********************************************************-->
>     <property name="src.sql" value="${basedir}\dbsource.sql"/>
>     <property name="dbtarget" value="d:\pb\network\databases"/>
>     <property name="DBNAME" value="swproc"/>
>     <property name="dba.uid" value="public"/>
>     <property name="dba.pwd" value="public"/>
>
>     <target name="init">
>         <tstamp/>
>         <echo message="Begining  database creation on ${TODAY} at
> ${TSTAMP}"/>
>         <echo message="executing from ${basedir}"/>
>     </target>
>
>     <target name="all" depends="init, MakeSchema">
>         <!-- <echo message="Hello ${world}!"/> -->
>     </target>
>
>     <!--*********************************************************-->
>     <!-- Use the PointBase commander utility                     -->
>     <!-- to create an empty database                             -->
>     <!-- and populate it with application tables                 -->
>     <!--*********************************************************-->
>     <target name="MakeSchema" depends="init">
>         <echo message="begining target MakeSchema at ${TSTAMP} using
> ${src.sql}"/>
>         <java classname="com.pointbase.tools.toolsCommander" fork="true">
>             <classpath>
>                 <pathelement
> location="D:\pb\client\classes\pbtools34GA.jar"/>
>                 <pathelement
> location="D:\pb\client\classes\pbclient34GA.jar"/>
>                 <pathelement location="D:\pb\client"/>
>             </classpath>
>             <arg value="com.pointbase.jdbc.jdbcUniversalDriver" />
>             <arg value="jdbc:pointbase://localhost/${DBNAME},new
${src.sql}"
> />
>             <arg value="${dba.uid} ${dba.pwd}" />
>         </java>
>         <echo message="completed target MakeSchema at ${TSTAMP} using
> ${src.sql}"/>
>     </target>
>
>
> </project>