Use DdlUtils and Ant to convert Schemas and data between different databases

Source: Internet
Author: User
Tags mssql server xml example
A variety of database types are often used in the development process. For example, projects may need to support Oracle, MySQL, MSSQLServer, Derby, and so on. There are already many small

A variety of database types are often used in the development process. For example, projects may need to support Oracle, MySQL, MSSQL Server, Derby, and so on. There are already many small

A variety of database types are often used in the development process. For example, projects may need to support Oracle, MySQL, MSSQL Server, Derby, and so on. There are already a variety of gadgets that can help developers perform schema, data conversion, and synchronization between databases. DdlUtils is one of them. It can combine Ant or program code to convert database schema/data and xml files.

For example, project development supports MySQL, and for the sake of cleanliness and convenience of unit testing, developers decide to use Derby to support unit testing. DdlUtils can export the schema and data from MySQL to an xml file, and then import the data to Derby as needed. Obviously, these exported xml files are also a good backup for the database.

The following is an xml example provided on the apache ddlutils official website. The table and column labels support more than the child and attribute in the example.

DdlUtils contains three Ant tasks: databaseToDdl, ddlToDatabase, and dumpMetadata.

Example of using ddlToDatabase:

This Ant task creates a PostgreSQL database and imports the schema and data defined in xml into the database.

Example of using databaseToDdl:

This Ant task exports schema and data from the derby database to an xml file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.