Java type: org.apache.ddlutils.task.DatabaseToDdlTask

Task for getting structural info and data from a live database. Eg. it has sub tasks for writing the schema of the live database or the data currently in it to an XML file, for creating the DTDs for these data files, and for generating SQL to creating a schema in the database to a file.

 <taskdef classname="org.apache.ddlutils.task.DatabaseToDdlTask"
          classpathref="project-classpath" />
 <databaseToDdl usedelimitedsqlidentifiers="true"
   <database driverclassname="org.apache.derby.jdbc.ClientDriver"
   <writeschematofile outputfile="schema.xml"/> 
   <writedatatofile outputfile="data.xml"
This reads the schema and data from the database and writes them to XML files.


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.

tabletypes : String

Specifies the table types to be processed. More precisely, all tables that are of a type not in this list, will be ignored by the task and its sub tasks. For details and typical table types see java.sql.DatabaseMetaData#getTables.
By default, only tables of type TABLE are used by the task.

modelname : String

Specifies the name of the model that is read from the database. This is mostly useful for the the writeSchemaToFile sub-task as it ensures that the generated XML defines a valid model.
By default, DldUtils uses the schema name returned from the database or "default" if no schema name was returned by the database.

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 : 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.

verbosity : String ["FATAL", "ERROR", "WARN", "INFO", "DEBUG", "fatal", "error", "warn", "info", "debug"]

Specifies the verbosity of the task's debug output.
Default is 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.

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.

Nested elements

⇒ database (an object of type org.apache.commons.dbcp.BasicDataSource)

⇒ writedatatofile

⇒ writeschemasqltofile

⇒ writedatatodatabase

⇒ writeschematofile

⇒ writedtdtofile

©2005-2007 Apache Software Foundation