public class DdlToDatabaseTask extends DatabaseTaskBase
<taskdef classname="org.apache.ddlutils.task.DdlToDatabaseTask"
name="ddlToDatabase"
classpathref="project-classpath"/>
<ddlToDatabase usedelimitedsqlidentifiers="true">
<database driverclassname="org.apache.derby.jdbc.ClientDriver"
url="jdbc:derby://localhost/ddlutils"
username="ddlutils"
password="ddlutils"/>
<fileset dir=".">
<include name="*schema.xml"/>
</fileset>
<createdatabase failonerror="false"/>
<writeschematodatabase alterdatabase="true"
failonerror="false"/>
<writedatatodatabase datafile="data.xml"
usebatchmode="true"
batchsize="1000"/>
</ddlToDatabase>
This Ant build file snippet essentially creates a database, creates tables, foreign keys
etc. int it and then writes data into the newly created tables._isolationLevel, _log| Constructor and Description |
|---|
DdlToDatabaseTask() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConfiguredFileset(org.apache.tools.ant.types.FileSet fileset)
Adds a fileset.
|
void |
addCreateDatabase(CreateDatabaseCommand command)
Adds the "create database"-command.
|
void |
addDropDatabase(DropDatabaseCommand command)
Adds the "drop database"-command.
|
void |
addWriteDataToDatabase(WriteDataToDatabaseCommand command)
Adds the "write data to database"-command.
|
void |
addWriteDataToFile(WriteDataToFileCommand command)
Adds the "write data to file"-command.
|
void |
addWriteDtdToFile(WriteDtdToFileCommand command)
Adds the "write dtd to file"-command.
|
void |
addWriteSchemaSqlToFile(WriteSchemaSqlToFileCommand command)
Adds the "write schema sql to file"-command.
|
void |
addWriteSchemaToDatabase(WriteSchemaToDatabaseCommand command)
Adds the "write schema to database"-command.
|
protected Database |
readModel()
Reads the database model on which the commands will work.
|
void |
setSchemaFile(File schemaFile)
Defines the single file that contains the database file.
|
void |
setUseInternalDtd(boolean useInternalDtd)
Specifies whether DdlUtils shall use the embedded DTD for validating the schema XML (if
it matches
http://db.apache.org/torque/dtd/database.dtd). |
void |
setValidateXml(boolean validateXml)
Specifies whether XML input files should be validated against the DTD at all.
|
addCommand, addConfiguredDatabase, execute, executeCommands, getCommands, getDatabaseType, getDataSource, getIsolationLevel, getPlatform, getPlatformConfiguration, hasCommands, isShutdownDatabase, isSortForeignKeys, isUseDelimitedSqlIdentifiers, setCatalogPattern, setDatabaseType, setIsolationLevel, setSchemaPattern, setShutdownDatabase, setSimpleLogging, setSortForeignKeys, setUseDelimitedSqlIdentifiers, setVerbositybindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypepublic void setUseInternalDtd(boolean useInternalDtd)
http://db.apache.org/torque/dtd/database.dtd). This is
especially useful in environments where no web access is possible or desired.useInternalDtd - true if input files are to be validated against the internal DTDpublic void setValidateXml(boolean validateXml)
validateXml - true if input files are to be validatedpublic void addConfiguredFileset(org.apache.tools.ant.types.FileSet fileset)
fileset - The additional input filespublic void setSchemaFile(File schemaFile)
fileset elements if you only have one schema file.schemaFile - The schemapublic void addCreateDatabase(CreateDatabaseCommand command)
command - The commandpublic void addDropDatabase(DropDatabaseCommand command)
command - The commandpublic void addWriteDtdToFile(WriteDtdToFileCommand command)
command - The commandpublic void addWriteSchemaToDatabase(WriteSchemaToDatabaseCommand command)
command - The commandpublic void addWriteSchemaSqlToFile(WriteSchemaSqlToFileCommand command)
command - The commandpublic void addWriteDataToDatabase(WriteDataToDatabaseCommand command)
command - The commandpublic void addWriteDataToFile(WriteDataToFileCommand command)
command - The commandprotected Database readModel()
readModel in class DatabaseTaskBaseCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.