You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Fredrik Westermarck <fr...@mdh.se> on 2005/12/06 20:38:30 UTC

The writeSchemaSqlToFile Anttask fails

Hi!

I have been trying to generate a DDL file from a XML file from within 
ant without succeeding. I'm using ddlutils with SVN rev 354492.

I my build.xml I have the following:
<target name="create.sql">
     <ddlToDatabase schemaFile="test.xml" databaseType="oracle">
       <writeSchemaSqlToFile doDrops="true"
                             failOnError="true"
                             outputFile="test.ddl"/>
     </ddlToDatabase>
   </target>

The XML file that describes the database for which to generate SQL 
statements looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>

<database name="test" version="1.0">
   <table name="test">
     <column name="code"
             type="VARCHAR"
             size="20"
             primaryKey="true"
             required="true"/>
     <column name="name"
             type="VARCHAR"
             size="40"
             required="true"/>
   </table>
</database>

When I run the ant task, it fails with the following message:

create.sql:
[ddlToDatabase] 2005-dec-06 20:24:11 
org.apache.commons.betwixt.expression.Context popOptions
[ddlToDatabase] INFO: Cannot pop options off empty stack
[ddlToDatabase] 2005-dec-06 20:24:11 
org.apache.commons.betwixt.expression.Context popOptions
[ddlToDatabase] INFO: Cannot pop options off empty stack
[ddlToDatabase] 2005-dec-06 20:24:11 
org.apache.commons.betwixt.expression.Context popOptions
[ddlToDatabase] INFO: Cannot pop options off empty stack
[ddlToDatabase] 2005-dec-06 20:24:11 
org.apache.commons.betwixt.expression.Context popOptions
[ddlToDatabase] INFO: Cannot pop options off empty stack
[ddlToDatabase] 2005-dec-06 20:24:11 
org.apache.commons.betwixt.expression.Context popOptions
[ddlToDatabase] INFO: Cannot pop options off empty stack
[ddlToDatabase] Read schema file D:\mdh\ddlutilstest\test.xml

BUILD FAILED
D:\code\ddlutilstest\build.xml:18: No database specified.

The error message indicates that I have not configured a DataSource, 
which is correct, but as far as I can tell the task 
'writeSchemaSqlToFile' does not require a DataSource.

Any help with this matter would be greatly appreciated.

-- 
Regards,
Fredrik Westermarck

Re: The writeSchemaSqlToFile Anttask fails

Posted by Fredrik Westermarck <fr...@mdh.se>.
Thomas Dudziak wrote:
>> I have been trying to generate a DDL file from a XML file from within
>> ant without succeeding. I'm using ddlutils with SVN rev 354492.
> 
>> BUILD FAILED
>> D:\code\ddlutilstest\build.xml:18: No database specified.
>>
>> The error message indicates that I have not configured a DataSource,
>> which is correct, but as far as I can tell the task
>> 'writeSchemaSqlToFile' does not require a DataSource.
> 
> You get this error because per default the task creates SQL for
> altering a database but you did not specify one. Simply add
> alterdatabase="false" to the writeSchemaSqlToFile subtask and it
> should work.

Yes, it worked fine with the suggested attribute. Thank you!

> Come to think of it, I will change this task so that alterdatabase is
> only checked if a datasource was specified.

That does seem to be a bit more logical - at least to me. :)

-- 
Regards,
Fredrik Westermarck



Re: The writeSchemaSqlToFile Anttask fails

Posted by Thomas Dudziak <to...@gmail.com>.
On 12/6/05, Fredrik Westermarck <fr...@mdh.se> wrote:

> I have been trying to generate a DDL file from a XML file from within
> ant without succeeding. I'm using ddlutils with SVN rev 354492.

<snip>

> BUILD FAILED
> D:\code\ddlutilstest\build.xml:18: No database specified.
>
> The error message indicates that I have not configured a DataSource,
> which is correct, but as far as I can tell the task
> 'writeSchemaSqlToFile' does not require a DataSource.

You get this error because per default the task creates SQL for
altering a database but you did not specify one. Simply add
alterdatabase="false" to the writeSchemaSqlToFile subtask and it
should work.
Come to think of it, I will change this task so that alterdatabase is
only checked if a datasource was specified.

Tom