On 7/14/06, Obs <[EMAIL PROTECTED]> wrote:
WriteDataToDatabaseCommand wdtd = new WriteDataToDatabaseCommand();
wdtd.setFailOnError(true);
wdtd.setDataFile(a);
wdtd.setEnsureForeignKeyOrder(true);
wdtd.setUseBatchMode(true);
wdtd.setBatchSize(100);
//Build task
DatabaseToDdlTask in = new DatabaseToDdlTask();
in.setUseDelimitedSqlIdentifiers(true);
in.addConfiguredDatabase(dcs.convertToBasicDataSource(destds));
in.addWriteDataToDatabase(wdtd);
in.execute();

Notice Im using the DatabaseToDdl task instead of the DdlToDatabase task,
except I'm loading data into the database from a previously generated xml.
If I try it from the DdlToDatabase task, I get

No database model specified
    at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(
DatabaseTaskBase.java:212)
    at org.apache.ddlutils.task.DatabaseTaskBase.execute(
DatabaseTaskBase.java:242)
    at com.creative.db.DatabaseTest.readFromDatabase(DatabaseTest.java:109)
    at com.creative.db.DatabaseCopy.main(DatabaseCopy.java:15)

You need a database model (i.e. tables etc.) because data is expressed
in terms of tables, columns etc. You can either read the model from
the database or specify an XML file.

Tom

Reply via email to