Java type: org.apache.ddlutils.task.DdlToDatabaseTask
org.apache.ddlutils.task.DdlToDatabaseTask
Task for performing operations on a live database. Sub tasks e.g. create the schema in the database, drop database schemas, insert data into the database, create DTDs for data files, or write the SQL for creating a schema to a file. Example:
<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>
schemapattern : String
Specifies a pattern that defines which database schemas to use. For some more info on schema patterns and JDBC, see java.sql.DatabaseMetaData. Per default no specific schema is used.
catalogpattern : String
Specifies a pattern that defines which database catalogs to use. For some more info on catalog patterns and JDBC, see java.sql.DatabaseMetaData. Per default no specific catalog is used.
sortforeignkeys : boolean
Specifies whether DdlUtils shall sort the foreign keys of a table read from a live database or leave them in the order in which they are returned by the database/JDBC driver. Note that the sort is case sensitive only if delimited identifier mode is on (useDelimitedSqlIdentifiers is set to true). Default is false.
useDelimitedSqlIdentifiers
true
false
usedelimitedsqlidentifiers : boolean
Specifies whether DdlUtils shall use delimited (quoted) identifiers (such as table and column names). Most databases convert undelimited identifiers to uppercase and ignore the case of identifiers when performing any SQL command. Undelimited identifiers also cannot be reserved words and can only contain alphanumerical characters and the underscore. These limitations do not exist for delimited identifiers where identifiers have to be enclosed in double quotes. Delimited identifiers can contain unicode characters, and even reserved words can be used as identifiers. Please be aware though, that they always have to enclosed in double quotes, and that the case of the identifier will be important in every SQL command executed against the database. Default is false.
useinternaldtd : boolean
Specifies whether DdlUtils shall use the embedded DTD for validating the schema XML (if it matches http://db.apache.org/torque/dtd/database.dtd). This is especially useful in environments where no web access is possible or desired. Default is true.
http://db.apache.org/torque/dtd/database.dtd
schemafile : File
Defines the single file that contains the database file. You can use this instead of embedded fileset elements if you only have one schema file. Use either this or one or more embedded fileset elements.
fileset
verbosity : String ["FATAL", "ERROR", "WARN", "INFO", "DEBUG", "fatal", "error", "warn", "info", "debug"]
Specifies the verbosity of the task's debug output. Default is INFO.
INFO
shutdowndatabase : boolean
Specifies whether DdlUtils shall shut down the database after the task has finished. This is mostly useful for embedded databases. Default is false.
simplelogging : boolean
Specifies whether simple logging (configured by the task via the verbosity setting) shall be used, or whether logging is configured outside of the task (e.g. via a log4j properties file). Per default, simple logging is enabled.
verbosity
validatexml : boolean
Specifies whether XML input files should be validated against the DTD at all. Default is false meaning that the XML is not validated at all.
databasetype : String
Specifies the database type. You should only need to set this if DdlUtils is not able to derive the setting from the name of the used jdbc driver or the jdbc connection url. If you have to specify this, please post your jdbc driver and connection url combo to the user mailing list so that DdlUtils can be enhanced to support this combo. Valid values are currently:axion, cloudscape, db2, derby, firebird, hsqldb, interbase, maxdb, mckoi, mssql, mysql, mysql5, oracle, oracle9, oracle10, postgresql, sapdb, sybase Per default, DdlUtils tries to determine the database type via JDBC.
axion, cloudscape, db2, derby, firebird, hsqldb, interbase, maxdb, mckoi, mssql, mysql, mysql5, oracle, oracle9, oracle10, postgresql, sapdb, sybase
⇒ Ant's fileset type
⇒ database (an object of type org.apache.commons.dbcp.BasicDataSource)
database
org.apache.commons.dbcp.BasicDataSource
⇒ createdatabase
createdatabase
⇒ writedtdtofile
writedtdtofile
⇒ writeschemasqltofile
writeschemasqltofile
⇒ writedatatofile
writedatatofile
⇒ writeschematodatabase
writeschematodatabase
⇒ dropdatabase
dropdatabase
⇒ writedatatodatabase
writedatatodatabase
©2005-2007 Apache Software Foundation