I want to export mysql database using ddlutils tool in ant
<target name="export-source-db" description="Dumps db structure and data">
<taskdef name="databaseToDdl"
classname="org.apache.ddlutils.task.DatabaseToDdlTask">
<classpath refid="libraries"/>
<classpath refid="mysqlclasspath"/>
</taskdef>
<databaseToDdl modelName="bwfla">
<database url="jdbc:mysql://localhost:3306/"
driverClassName="com.mysql.jdbc.Driver"
username="root"
password="sriram"/>
<writeSchemaToFile outputFile="db-schema.xml"/>
<writeDataToFile outputFile="data.xml"/>
</databaseToDdl>
</target>
but if I check db-schema.xml
<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
<database name="bwfla"/>
and data.xml is
<?xml version='1.0' encoding='UTF-8'?>
<data>
</data>
it is not exporting data. could anyone help me.
I think your problem is the database URL:
You haven't specified the database to connect to. Should be something like:
I would also suggest not connecting as "root". Create a mysql user with access to your database.
Aside: Checkout liquibase. I think it's a more powerful tool for managing db schemas.
Working Example
I use apache ivy to manage my 3rd party dependencies. Just ignore the "bootstrap" and "resolve" targets.