Questions tagged [ddlutils]

DdlUtils is an apache utility which generates database schemas (tables, fields) for multiple databases using a common XML format.

Apache DdlUtils is an apache utility which can generate database DDL for multiple databases from a common XML format. Examples of target databases might be PostgreSQL, HSqlDB or Oracle.

An XML definition for a simple database might look like:

<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
<database name="stackoverflow">
  <table name="question">
    <column name="question_id"
            type="VARCHAR"
            size="40"
            primaryKey="true"
            required="true"/>
    <column name="title"
            type="VARCHAR"
            size="50"
            required="true"/>
    <column name="user_id"
            type="INTEGER"
            required="true"/>
    <column name="question"
            type="VARCHAR"
            size="255"
            required="true"/>
  </table>

  <table name="answers">
    <column name="answer_id"
            type="INTEGER"
            required="true"
            primaryKey="true"
            autoIncrement="true"/>
    <column name="question_id"
            type="VARCHAR"
            size="40"
            required="true"/>
    <column name="user_id"
            type="INTEGER"
            required="true"/>
    <column name="markdown"
            type="VARCHAR"
            size="255"
            defaultValue=""
            required="true"/>

    <foreign-key foreignTable="question">
      <reference local="question_id" foreign="question_id"/>
    </foreign-key>  

    <index name="user_id_idx">
      <index-column name="user_id"/>
    </index>
  </table>
</database>

DdlUtils includes integration with Ant for:

  • Generating database DDL from a supplied XML file (model)
  • Generating the DdlUtils XML model from an existing database.

Useful links:

18 questions
16
votes
4 answers

Alternatives to DDLUtils from apache

I would like to know which alternatives exist to replace DDL utils from Apache. I ask this because ddlutils project seams to be Dead, and also it does not support H2 Databases. I've searched for it, and I found suggestions like liquidbase or…
user1680680
  • 213
  • 2
  • 9
9
votes
2 answers

Easiest way to obtain database metadata in Java?

I'm familiar with the java.sql.DatabaseMetaData interface, but I find it quite clunky to use. For example, in order to find out the table names, you have to call getTables and loop through the returned ResultSet, using well-known literals as the…
Andrew Swan
  • 13,427
  • 22
  • 69
  • 98
9
votes
2 answers

Java library for reading database schema

I'm looking for a lightweight, open source, more or less cross-database Java library that would allow me to read off metainformation on columns, tables and integrity constraints given a DataSource.
Marat Salikhov
  • 6,367
  • 4
  • 32
  • 35
4
votes
1 answer

Nested Exception vs modern (Java SE 7) exceptions

Question What are the advantages and disadvantages of exceptions with context vs nested exceptions? Why I care As a developer who doesn't have a background in or know the background of Java, I have stumbled upon a possible opportunity to update an…
Key Lay
  • 366
  • 3
  • 13
3
votes
5 answers

How to make my webApp switch between different DBMS smoothly(DB Independency)?

I have a Java web application that has Informix as its back end database. Many tables in my schema contain columns of type CLOB, BLOB & SERIAL8. Now I made a decision to use SQL Server instead of Informix but I found a problem in converting the…
Eslam Hamdy
  • 7,126
  • 27
  • 105
  • 165
2
votes
2 answers

DdlUtils: defering insertion

in order to migrate a db from oracle to mysql i am using ddlutils. Migrating the schema works for my purposes, but inserting the data fails due to missing rows. The following excerpt from the log file explains it: [ddlToDatabase] About to execute…
GLA
  • 953
  • 2
  • 9
  • 14
2
votes
1 answer

Problem using DdlUtils with Oracle 11.1.0

This question is similar to question https://stackoverflow.com/questions/3362965/problem-with-ddlutils-in-oracle-10g. Since my problem is (or at least i think it is) slightly different to the question mentioned, i post a new one. I am using…
GLA
  • 953
  • 2
  • 9
  • 14
2
votes
0 answers

Migrate large mySQL Database to derby using DdlUtils

I want to migrate a MySQL database to a Derby-DB using DdlUtils. For that I defined the following ant-script:
user3776894
  • 183
  • 1
  • 8
1
vote
1 answer

Problems on converting Database with ddlutils

I have to convert a mysql-database into a java (derby) database. This works fine with ant-tasks, absolutely no problem. Unfortunately not all the tables out of the orginin-database may be used in the target-database. As i found no chance to filter…
1
vote
2 answers

Auto-incrementation with HSQLDB (2.2.8) + DDLUtils

I want to use HSQLDB as an embedded database but am having trouble getting it to auto-increment. As far as I understand, [CALL] IDENTITY() can be used to get the last primary key value. However, experiments through both iBatis and HSQLDB's…
James P.
  • 19,313
  • 27
  • 97
  • 155
1
vote
2 answers

Problem in using org.apache.ddlutils.DdlUtilsException

I'm trying to use the org.apache.ddlutils package for reading database metadata. I've written the following method: public static void readMetaData(DataSource dataSource) throws DdlUtilsException{ final Platform platform =…
n_g
  • 3,315
  • 8
  • 25
  • 29
1
vote
2 answers

Is there any way to convert derby database table rows to SQL insert statements

I have successfully exported the Derby schema using ddlUtils but how do I export table data in derby to insert SQL statements?
oyers
  • 35
  • 6
0
votes
0 answers

SQL DDL generate patch sql

I am currently using Apache DdlUtils to generate SQL for different databases using XML. Is there a tool that can automatically generate patch SQL for different versions? For example, from version 1.0 to 2.0: Some tables added new columns. Some…
Ziv
  • 119
  • 7
0
votes
0 answers

Incompatible types ddlutils catch block

I am trying to write my database to XML using ddlutils, but I needed a try/catch block. However, when I used the following code I am getting the error "Incompatible types: Required: java.lang.throwable Found:…
dgelinas21
  • 641
  • 3
  • 9
  • 22
0
votes
1 answer

HSQL Error: org.hsqldb.HsqlException: primary key already exist

I am using the old-school ddlutils lib to create a schema in hsql, and am seeing this error. It is strange because the primary key is only created once. org.apache.ddlutils.DatabaseOperationException: Error while executing SQL --…
mtyson
  • 8,196
  • 16
  • 66
  • 106
1
2