|
UsingTheAntInterface
How to invoke dbdeploy from ant
In the supplied distribution is an example ant file, examples/build.xml. You can probably just get started using that. Here a step by step instructions. Classpath and taskdefYou need to declare the dbdeploy task to ant. The dbdeploy task needs to talk to your database, so the task classpath should also include the database drivers, e.g. <path id="hsql.classpath">
<fileset dir="lib">
<include name="hsqldb*.jar"/>
</fileset>
</path>
<path id="dbdeploy.classpath">
<!-- include the dbdeploy-ant jar -->
<fileset dir="lib">
<include name="dbdeploy-ant-*.jar"/>
</fileset>
<!-- the dbdeploy task also needs the database driver jar on the classpath -->
<path refid="hsql.classpath" />
</path>
Then, you can declare the dbdeploy task: <taskdef name="dbdeploy" classname="com.dbdeploy.AntTarget" classpathref="dbdeploy.classpath"/> Invoking dbdeployNext include a call to the dbdeploy task in the relevant database target, for example: <dbdeploy
driver="org.hsqldb.jdbcDriver"
url="jdbc:hsqldb:hsql://localhost/xdb"
userid="sa"
password="s3cur1ty"
dir="db\deltas"
/>The parameters are as follows:
Note that delimiter and delimitertype are intentionally the same as the same parameters provided by the ant sql task. |
Sign in to add a comment
The version that I'm using (3.0M1) uses the attribute "lastChangeToApply" instead of "maxNumberToApply".
Thanks - the docs were wrong, updated now
Still no dbms support for postgres? I see that it was discussed in http://groups.google.com/group/db-deploy-users/browse_thread/thread/dd958110e5e5c3f8 - but no patch has been applied, as far as I can see.
tfnico: thanks for raising issue 26 and sending a patch. pgsql is now supported and on the list above :)
How do you supply classpathref to dbdeploy task so it can find DB drivers ?
@cloudforge: you need to do it in the taskdef, not when you invoke dbdeploy. So in the example above:
notice that dbdeploy.classpath has got both the dbdeploy jar and the database jar within in it.