You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Kathey Marsden <km...@sbcglobal.net> on 2009/06/13 02:04:06 UTC

using ij in an ant task to create a database and nothing else

Someone asked me today how to create a database with ij in an ant task 
by just using ij.database if they don't have any script to execute.  He 
had implemented the following workaround to create a temporary file with 
just "quit;" in it.


 <tempfile property="${TEMP_DIR}/quit.file"/>
        <echo file="${TEMP_DIR}/quit.file" message="quit;"/>
        <java classname="org.apache.derby.tools.ij" fork="true" 
failonerror="${common.failonerror}" dir="${TEMP_DIR}">
            <jvmarg 
value="-Djava.ext.dirs=${java.ext.dirs}${path.separator}${install.root}/derby/lib" 
/>
            <jvmarg value="-Dij.protocol=jdbc:derby:" />
            <jvmarg value="-Dij.database=${DB_URL_EXEC};create=true" />
            <arg value="${TEMP_DIR}/quit.file" />
        </java>


But it seems like there should be a way to do this without creating the 
temporary file.  ideas?

Thanks

Kathey

Re: using ij in an ant task to create a database and nothing else

Posted by Andrew McIntyre <mc...@gmail.com>.
On Fri, Jun 12, 2009 at 5:04 PM, Kathey
Marsden<km...@sbcglobal.net> wrote:
> Someone asked me today how to create a database with ij in an ant task by
> just using ij.database if they don't have any script to execute.  He had
> implemented the following workaround to create a temporary file with just
> "quit;" in it.

What about using Ant's sql task? I checked and this created the
database without needing to touch any files:

<sql driver="org.apache.derby."
    url="jdbc:derby:mydb;create=true"
    userid=""
    password="">
set schema app;
</sql>

It requires that you have *some* sql in there, so a set schema works nicely.

andrew