|  |  |  | License Codehaus OpenEJB OpenJMS OpenORB Tyrex

Old releases
General
Release 1.3
Release 1.3rc1
Release 1.2

Main
Home
About
Features
Download
Dependencies
Reference guide
Publications
JavaDoc
Maven 2 support
Maven 2 archetypes
DTD & Schemas
Recent HTML changes
News Archive
RSS news feed
Project Wiki

Development/Support
Mailing Lists
SVN/JIRA
Contributing
Support
Continuous builds
Prof. services

Related projects
Spring ORM support
Spring XML factories
WS frameworks

XML
XML

XML Code Generator
XML Code Generator

JDO
Introduction
First steps
Using JDO
JDO Config
Types
JDO Mapping
JDO FAQ
JDO Examples
JDO HOW-TOs
Tips & Tricks
Other Features
JDO sample JAR

Tools
Schema generator

Advanced JDO
Caching
OQL
Trans. & Locks
Design
KeyGen
Long Trans.
Nested Attrs.
Pooling Examples
LOBs
Best practice

DDL Generator
Using DDL Generator
Properties
Ant task
Type Mapping

More
The Examples
3rd Party Tools
JDO Tests
XML Tests
Configuration

About
License
User stories
Contributors
Marketplace
Status, Todo
Changelog
Library
Contact
Project Name

## Using DDL Generator

Documentation Author(s):
Ralf Joachim

API Reference: DDL Generator API

Introduction
DDL Generator Options
Command Line Options
Database Engines

## Introduction

Castor DDL Generator creates a SQL script to drop/create tables, unique keys, sequences and so on from a Castor JDO mapping file.

Example:

    java org.castor.ddlgen.Main -m mapping.xml

This will generate the SQL script `mapping.sql` in the same directory `mapping.xml` is located.

## DDL Generator Options

The DDL Generator has a number of different options which may be set. Some of them are specified at the command line while others need to be configured through a properties file. Most of the options are located in global properties file `org/castor/ddlgen/ddlgen.properties` but there are also some options that are specific for one database engine. The specific properties can be found at `org/castor/ddlgen/engine/<database>/<database>.properties`.

### Command Line Options

Option | Args | Description | Optional?
m | filename | Castor JDO mapping file to generate DDL for. | Required
o | filename | Name of file the generated DDL will be written to. If not specified the generated DDL will be written to a file named similar as the Castor JDO mapping source file with `xml` extension being replaced by `sql`. | Optional
e | database engine | Name of database engine to generate DDL for. The engine used as default can be specified with `org.castor.ddlgen.DefaultEngine` option of global properties file. | Optional
c | filename | Alternative global properties file to be used when generating DDL. | Optional
d | filename | Alternative database specific properties file to be used when generating DDL. | Optional
h |  | Shows help/usage information. | Optional

### Database Engines

The DDL Generator supports generation of SQL scripts for the following database engines:

Name | Database Engine | Specific properties file
db2 | DB/2 | org/castor/ddlgen/engine/db2/db2.properties
derby | Derby | org/castor/ddlgen/engine/derby/derby.properties
hsql | Hypersonic SQL | org/castor/ddlgen/engine/hsql/hsql.properties
mssql | Microsoft SQL Server | org/castor/ddlgen/engine/mssql/mssql.properties
mysql | MySQL | org/castor/ddlgen/engine/mysql/mysql.properties
oracle | Oracle | org/castor/ddlgen/engine/oracle/oracle.properties
pointbase | Borland Pointbase | org/castor/ddlgen/engine/pointbase/pointbase.properties
postgresql | PostgreSQL | org/castor/ddlgen/engine/postgresql/postgresql.properties
sapdb | SAP DB / MaxDB | org/castor/ddlgen/engine/sapdb/sapdb.properties
sybase | Sybase | org/castor/ddlgen/engine/sybase/sybase.properties

<notice> Copyright © 1999-2005 ExoLab Group, Intalio Inc., and Contributors. All rights reserved. </notice>
<notice> Java, EJB, JDBC, JNDI, JTA, Sun, Sun Microsystems are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and in other countries. XML, XML Schema, XSLT and related standards are trademarks or registered trademarks of MIT, INRIA, Keio or others, and a product of the World Wide Web Consortium. All other product names mentioned herein are trademarks of their respective owners. </notice>