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 Obs <ob...@gmail.com> on 2006/07/14 15:24:48 UTC
MSSQL, ANT Tasks, Identity insert
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)
Since that does that, I think it's causing the IDENTITY_INSERT feature to
not work.
--
Obs
Re: MSSQL, ANT Tasks, Identity insert
Posted by Thomas Dudziak <to...@gmail.com>.
On 7/14/06, Obs <ob...@gmail.com> wrote:
> I guess my follow up question would be, how does the model get set for the
> DdlToDatabaseTask? I figured it would get ot from the
> WriteDataToDatabaseCommand where you set the file to be read in
Actually, why do you use the Ant tasks in your code at all ? The API
(http://db.apache.org/ddlutils/api-usage.html) is actually easier, so
you might want to use that instead.
Tom
Re: MSSQL, ANT Tasks, Identity insert
Posted by Obs <ob...@gmail.com>.
I guess my follow up question would be, how does the model get set for the
DdlToDatabaseTask? I figured it would get ot from the
WriteDataToDatabaseCommand where you set the file to be read in
On 7/14/06, Thomas Dudziak <to...@gmail.com> wrote:
>
> On 7/14/06, Obs <ob...@gmail.com> 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
>
--
Obs
Re: MSSQL, ANT Tasks, Identity insert
Posted by Thomas Dudziak <to...@gmail.com>.
On 7/14/06, Obs <ob...@gmail.com> 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