<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sheila&#039;s Blog &#187; database</title>
	<atom:link href="http://sheilapollard.com/category/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://sheilapollard.com</link>
	<description>Software Development</description>
	<lastBuildDate>Wed, 24 Mar 2010 17:19:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Automated Build &#8211; Mysql database scripts</title>
		<link>http://sheilapollard.com/2009/03/30/automated-build-mysql-database-scripts/?utm_campaign=feed&utm_medium=feed&utm_source=blog</link>
		<comments>http://sheilapollard.com/2009/03/30/automated-build-mysql-database-scripts/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 10:07:31 +0000</pubDate>
		<dc:creator>Sheila</dc:creator>
				<category><![CDATA[build]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[automated build]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://sheilapollard.wordpress.com/?p=202</guid>
		<description><![CDATA[Having set up the basic folder structure in Automated Build Databse scripts you now need to add the mysql scripts.
You create them in PROJECT_HOME/db/mysql/testdb
db/mysql/testdb/build-mysql-testdb.xml
db/mysql/testdb/createTables.sql
db/mysql/testdb/dropTables.sql
db/mysql/testdb/populateTables.sql
db/mysql/testdb/testData.sql
The build script itself is fairly self-explanatory.  It replicates the targets from the master build script.  It reads the mysql.properties and schema.properties files and adds the correct jar file to the classpath.
For [...]]]></description>
			<content:encoded><![CDATA[<p>Having set up the basic folder structure in <a href="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NoZWlsYXBvbGxhcmQuY29tLzIwMDkvMDMvMjUvYXV0b21hdGVkLWJ1aWxkLWRhdGFiYXNlLXNjcmlwdHMvP3V0bV9jYW1wYWlnbj1mZWVkJnV0bV9tZWRpdW09ZmVlZCZ1dG1fc291cmNlPWJsb2c=">Automated Build Databse scripts</a> you now need to add the mysql scripts.</p>
<p>You create them in PROJECT_HOME/db/mysql/testdb
<code>db/mysql/testdb/build-mysql-testdb.xml
db/mysql/testdb/createTables.sql
db/mysql/testdb/dropTables.sql
db/mysql/testdb/populateTables.sql
db/mysql/testdb/testData.sql</code></p>
<p>The build script itself is fairly self-explanatory.  It replicates the targets from the master build script.  It reads the mysql.properties and schema.properties files and adds the correct jar file to the classpath.</p>
<p>For each target you first check if the property mysql.db.enable has been set so the target will only run if you’ve configured schema.properties to include the mysql database.   For each target you connect to the database and execute the sql in the appropriate sql script.</p>
<p>mysql/testdb/build-mysql-testdb.xml:
<code>&lt;?xml version="1.0"?&gt;

&lt;project basedir="."  name="-build"&gt;

  &lt;property file="../../config/mysql.properties" /&gt;
  &lt;property file="../../config/schema.properties" /&gt;
  &lt;property name="lib.dir" value="../../lib" /&gt;

  &lt;!-- Class path settings --&gt;
  &lt;fileset id="lib" dir="${lib.dir}/mysql"&gt;
    &lt;include name="*.jar" /&gt;
  &lt;/fileset&gt;
  &lt;path id="classpath"&gt;
    &lt;fileset refid="lib" /&gt;
  &lt;/path&gt;

  &lt;target name="createUser" if="mysql.db.enable" description="Creates user and schema specified in properties file"&gt;
    &lt;echo&gt;Executing mysql-airline:createUser &lt;/echo&gt;
    &lt;sql driver="${mysql.driver}"
      url="${mysql.url}"
      userid="${mysql.rootuser}"
      password="${mysql.rootpass}"
      print="${print}"&gt;
      &lt;classpath refid="classpath"/&gt;

        create schema ${mysql.schema};
        GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,ALTER,INDEX,DROP
        ON ${mysql.schema}.*
        TO '${mysql.username}'@'${mysql.user.location}'
        IDENTIFIED BY '${mysql.password}';
    &lt;/sql&gt;
  &lt;/target&gt;

  &lt;target name="dropUser" if="mysql.db.enable" description="Drops user and schema specified in properties file"&gt;
    &lt;echo&gt;Executing mysql-airline:dropUser &lt;/echo&gt;
    &lt;sql driver="${mysql.driver}"
      url="${mysql.url}"
      userid="${mysql.rootuser}"
      password="${mysql.rootpass}"
      print="${print}"
      onerror="continue"&gt;
      &lt;classpath refid="classpath"/&gt;

      drop schema ${mysql.schema};
      drop user '${mysql.username}'@'${mysql.user.location}';
    &lt;/sql&gt;
  &lt;/target&gt;

  &lt;target name="recreateTables" if="mysql.db.enable" depends="dropUser,createUser,createTables,populateTables,testData" description="refreshes the database tables"/&gt;

  &lt;target name="createTables" if="mysql.db.enable" description="Creates Database Tables"&gt;
    &lt;echo&gt;Executing mysql-airline:createTables &lt;/echo&gt;
    &lt;sql driver="${mysql.driver}"
      src="${mysql.create.tables.script}"
      url="${mysql.url}/${mysql.schema}"
      userid="${mysql.username}"
      password="${mysql.password}"
      print="${print}"&gt;
      &lt;classpath refid="classpath"/&gt;
    &lt;/sql&gt;
  &lt;/target&gt;

  &lt;target name="populateTables" if="mysql.db.enable" description="Populates Database Tables"&gt;
    &lt;echo&gt;Executing mysql-airline:populateTables &lt;/echo&gt;
    &lt;sql driver="${mysql.driver}"
      src="${mysql.populate.tables.script}"
      url="${mysql.url}/${mysql.schema}"
      userid="${mysql.username}"
      password="${mysql.password}"
      print="${print}"&gt;
      &lt;classpath refid="classpath"/&gt;
    &lt;/sql&gt;
  &lt;/target&gt;

  &lt;target name="dropTables" if="mysql.db.enable" description="Drops Database Tables"&gt;
    &lt;echo&gt;Executing mysql-airline:dropTables &lt;/echo&gt;
    &lt;sql driver="${mysql.driver}"
      url="${mysql.url}/${mysql.schema}"
      userid="${mysql.username}"
      password="${mysql.password}"
      src="${mysql.drop.tables.script}"
      print="${print}"
      onerror="continue"&gt;
      &lt;classpath refid="classpath"/&gt;
    &lt;/sql&gt;
  &lt;/target&gt;

  &lt;target name="testData" if="mysql.db.enable" description="Refreshes test data"&gt;
    &lt;echo&gt;Executing mysql-airline:testData &lt;/echo&gt;
    &lt;sql driver="${mysql.driver}"
      src="${mysql.testdata.script}"
      url="${mysql.url}/${mysql.schema}"
      userid="${mysql.username}"
      password="${mysql.password}"
      print="${print}"&gt;
      &lt;classpath refid="classpath"/&gt;
    &lt;/sql&gt;
  &lt;/target&gt;

&lt;/project&gt;</code></p>
<p>You then edit the sql scripts to add the tables and data needed for your schema.  Note that for targets that drop tables or users we set onerror=&#8221;continue&#8221; so that the build won&#8217;t fail if you add in new tables and attempt to drop them before they&#8217;ve been created.</p>
<br /><a href="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NoZWlsYXBvbGxhcmQud29yZHByZXNzLmNvbS8/cD0yMDIjY29tbWVudHM=" title=\"Comments on &quot;Automated Build &#8211; Mysql database scripts&quot;\"><img src="http://sheilapollard.com/wp-content/plugins/feed-comments-number/image.php?202" alt="Comments" /></a> <img src="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?view=1&post_id=202" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://sheilapollard.com/2009/03/30/automated-build-mysql-database-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automated Build &#8211; OracleXe database scripts</title>
		<link>http://sheilapollard.com/2009/03/27/automated-build-oraclexe-database-scripts/?utm_campaign=feed&utm_medium=feed&utm_source=blog</link>
		<comments>http://sheilapollard.com/2009/03/27/automated-build-oraclexe-database-scripts/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 12:08:37 +0000</pubDate>
		<dc:creator>Sheila</dc:creator>
				<category><![CDATA[build]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[automated build]]></category>
		<category><![CDATA[oraclexe]]></category>

		<guid isPermaLink="false">http://sheilapollard.wordpress.com/?p=200</guid>
		<description><![CDATA[Having set up the database folder structure in Automated Build Database scripts you now need to add the oracle xe scripts.
You create them in PROJECT_HOME/db/oraclexe/testdb
db/oraclexe/testdb/build-oraclexe-testdb.xml
db/oraclexe/testdb/createTables.sql
db/oraclexe/testdb/dropTables.sql
db/oraclexe/testdb/populateTables.sql
db/oraclexe/testdb/testData.sql
The build script itself is fairly self-explanatory.  It replicates the targets from the master build script.  It reads the xe.properties and schema.properties files and adds the correct jar file to the [...]]]></description>
			<content:encoded><![CDATA[<p>Having set up the database folder structure in <a href="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NoZWlsYXBvbGxhcmQuY29tLzIwMDkvMDMvMjUvYXV0b21hdGVkLWJ1aWxkLWRhdGFiYXNlLXNjcmlwdHMvP3V0bV9jYW1wYWlnbj1mZWVkJnV0bV9tZWRpdW09ZmVlZCZ1dG1fc291cmNlPWJsb2c=">Automated Build Database scripts</a> you now need to add the oracle xe scripts.</p>
<p>You create them in PROJECT_HOME/db/oraclexe/testdb
<code>db/oraclexe/testdb/build-oraclexe-testdb.xml
db/oraclexe/testdb/createTables.sql
db/oraclexe/testdb/dropTables.sql
db/oraclexe/testdb/populateTables.sql
db/oraclexe/testdb/testData.sql</code></p>
<p>The build script itself is fairly self-explanatory.  It replicates the targets from the master build script.  It reads the xe.properties and schema.properties files and adds the correct jar file to the classpath.</p>
<p>For each target you first check if the property oraclexe.db.enable has been set so the target will only run if you&#8217;ve configured schema.properties to include the oraclexe database.   Then in each target you connect to the database and execute the statements in the appropriate sql script.</p>
<p>oraclexe/testdb/build-xe-testdb.xml:
<code>&lt;?xml version="1.0"?&gt;

&lt;project basedir="." name="xe-mdm-build"&gt;

  &lt;property file="../../config/schema.properties" /&gt;
  &lt;property file="../../config/xe.properties" /&gt;
  &lt;property name="template.dir" value="../templates" /&gt;
  &lt;property name="lib.dir" value="../../lib" /&gt;
  &lt;property name="build.dir" value="../../build" /&gt;

  &lt;!-- Class path settings --&gt;
  &lt;fileset id="lib" dir="${lib.dir}/oracle"&gt;
    &lt;include name="*.jar" /&gt;
  &lt;/fileset&gt;
  &lt;path id="classpath"&gt;
    &lt;fileset refid="lib" /&gt;
  &lt;/path&gt;

  &lt;target name="init" if="xe.db.enable"&gt;
    &lt;mkdir dir="${build.dir}"/&gt;
  &lt;/target&gt;

  &lt;target name="clean" if="xe.db.enable"&gt;
    &lt;delete dir="${build.dir}"/&gt;
  &lt;/target&gt;

  &lt;target name="gen-sql" if="xe.db.enable" depends="clean,init" description="Generates the sql files"&gt;
    &lt;copy file="${template.dir}/createUser.template" tofile="${build.dir}/createTestUser.sql" overwrite="true"&gt;
      &lt;!-- replace template tokens marked with ~~ before and after --&gt;
      &lt;filterset begintoken="~~" endtoken="~~"&gt;
        &lt;filter token="template.username" value="${xe.username}" /&gt;
        &lt;filter token="template.password" value="${xe.password}" /&gt;
      &lt;/filterset&gt;
    &lt;/copy&gt;
    &lt;copy file="${template.dir}/dropUser.template" tofile="${build.dir}/dropTestUser.sql" overwrite="true"&gt;
      &lt;!-- replace template tokens marked with ~~ before and after --&gt;
      &lt;filterset begintoken="~~" endtoken="~~"&gt;
        &lt;filter token="template.username" value="${xe.username}" /&gt;
      &lt;/filterset&gt;
    &lt;/copy&gt;
  &lt;/target&gt;

  &lt;target name="createUser" if="xe.db.enable" depends="gen-sql" description="Creates user specified in properties file"&gt;
    &lt;echo&gt;Executing xe-mdm:createUser &lt;/echo&gt;
    &lt;exec dir="${template.dir}" executable="cmd"&gt;
      &lt;arg line="/c run.bat ${xe.rootuser} ${xe.rootpass} ${xe.sid} ${build.dir}/createTestUser.sql"/&gt;
    &lt;/exec&gt;
  &lt;/target&gt;

  &lt;target name="dropUser" if="xe.db.enable" depends="gen-sql" description="Creates user specified in properties file"&gt;
    &lt;echo&gt;Executing xe-mdm:dropUser &lt;/echo&gt;
    &lt;exec dir="${template.dir}" executable="cmd"&gt;
      &lt;arg line="/c run.bat ${xe.rootuser} ${xe.rootpass} ${xe.sid} ${build.dir}/dropTestUser.sql"/&gt;
    &lt;/exec&gt;
  &lt;/target&gt;

  &lt;target name="recreateTables" depends="dropTables,createTables,populateTables,testData" description="Refreshes the database tables"/&gt;

  &lt;target name="createTables" if="xe.db.enable" description="Creates Database Tables"&gt;
    &lt;echo&gt;Executing xe-mdm:createtables &lt;/echo&gt;
    &lt;sql driver="${xe.driver}"
      src="${xe.create.tables.script}"
      url="${xe.url}"
      userid="${xe.username}"
      password="${xe.password}"
      print="${print}"&gt;
      &lt;classpath refid="classpath"/&gt;
    &lt;/sql&gt;
  &lt;/target&gt;

  &lt;target name="populateTables" if="xe.db.enable" description="Populates Database Tables"&gt;
    &lt;echo&gt;Executing xe-mdm:populateTables &lt;/echo&gt;
    &lt;sql driver="${xe.driver}"
      src="${xe.populate.tables.script}"
      url="${xe.url}"
      userid="${xe.username}"
      password="${xe.password}"
      print="${print}"&gt;
      &lt;classpath refid="classpath"/&gt;
    &lt;/sql&gt;
  &lt;/target&gt;

  &lt;target name="dropTables" if="xe.db.enable" description="Drops the Database Tables"&gt;
    &lt;echo&gt;Executing xe-mdm:dropTables &lt;/echo&gt;
    &lt;sql driver="${xe.driver}"
      src="${xe.drop.tables.script}"
      url="${xe.url}"
      userid="${xe.username}"
      password="${xe.password}"
      print="${print}"
      onerror="continue"&gt;
      &lt;classpath refid="classpath"/&gt;
    &lt;/sql&gt;
  &lt;/target&gt;

  &lt;target name="testData" if="xe.db.enable" description="Refreshes test data"&gt;
    &lt;echo&gt;Executing xe-mdm:testData &lt;/echo&gt;
    &lt;sql driver="${xe.driver}"
      src="${xe.testdata.script}"
      url="${xe.url}"
      userid="${xe.username}"
      password="${xe.password}"
      print="${print}"&gt;
      &lt;classpath refid="classpath"/&gt;
    &lt;/sql&gt;
  &lt;/target&gt;

&lt;/project&gt;</code></p>
<p>For oraclexe you need to generate scripts for creating and dropping the user and run them from a batch file.  The values in xe.properties are used to fill in the details.  Create the following templates:</p>
<p>oraclexe/templates/createUser.template:
<code>create user ~~template.username~~ identified by ~~template.password~~
DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp QUOTA 50M ON users;
GRANT CONNECT, RESOURCE TO ~~template.username~~;</code></p>
<p>oraclexe/templates/dropUser.template:
<code&gt;drop USER ~~template.username~~ CASCADE;&lt;/code></p>
<p>In createUser.template we want to sustitute a value for the token template.username.  We choose ~~ to indicate the start and end of the token.  In the gen-sql target you state the start and end of the tokens are ~~ and indicate which value should replace the token in the template.  In this case ~~template.username~~ will be replaced with the xe.username value.  The generated sql scripts will be stored in db/build.</p>
<p>oraclexe/templates/run.bat:<code>@echo off

SET sysdba_userid=%1
SET sysdba_psswd=%2
SET sid=%3
SET sql_file=%4

SQLPlus %sysdba_userid%/%sysdba_psswd%@%sid% as sysdba @%sql_file%

echo Finished processing, exiting ...</code></p>
<p>The createUser and dropUser targets are run after gen-sql.  They execute a command line prompt and pass the database connection details and sql script to run.bat before launching it.</p>
<p>Now the only thing left to do is add the sql statements to the .sql scripts to create the database you want.  Note that for targets that drop tables or users we set onerror="continue" so that the build won't fail if you add in new tables and attempt to drop them before they've been created.</p>
<br /><a href="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NoZWlsYXBvbGxhcmQud29yZHByZXNzLmNvbS8/cD0yMDAjY29tbWVudHM=" title=\"Comments on &quot;Automated Build &#8211; OracleXe database scripts&quot;\"><img src="http://sheilapollard.com/wp-content/plugins/feed-comments-number/image.php?200" alt="Comments" /></a> <img src="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?view=1&post_id=200" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://sheilapollard.com/2009/03/27/automated-build-oraclexe-database-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automated Build &#8211; Database scripts</title>
		<link>http://sheilapollard.com/2009/03/25/automated-build-database-scripts/?utm_campaign=feed&utm_medium=feed&utm_source=blog</link>
		<comments>http://sheilapollard.com/2009/03/25/automated-build-database-scripts/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 17:42:38 +0000</pubDate>
		<dc:creator>Sheila</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[automated build]]></category>
		<category><![CDATA[database scripts]]></category>

		<guid isPermaLink="false">http://sheilapollard.wordpress.com/?p=197</guid>
		<description><![CDATA[When you&#8217;re developing a project, you put all your java code into source control.  You should also include database scripts in source control.  These scripts can be used by developers to keep their local copies of the database up to date in the same way as they get the latest code from source control.
As part [...]]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re developing a project, you put all your java code into source control.  You should also include database scripts in source control.  These scripts can be used by developers to keep their local copies of the database up to date in the same way as they get the latest code from source control.</p>
<p>As part of your automated build system you should run the database scripts whenever there&#8217;s a change to keep your code and database in synch.  You can add the code into your existing build in a db folder or check it into source control separately.</p>
<p>You follow almost the same process whether adding scripts for mysql or oraclexe and can modify the scripts to cater for multiple schemas across different databases.   In this example we&#8217;ll cover the configuration for setting up the testdb schema in both oraclexe and mysql before writing the scripts for each.  This example assumes you already have both databases running locally on your machine.</p>
<p>To start with you create a PROJECT_HOME/db folder which contains:
<code>db/config
db/datasources
db/lib
db/oraclexe/testdb
db/mysql/testdb</code></p>
<p>In the lib folder add the connector jars for the databases eg.
<code>db/lib/oracle/ojdbc5.jar
db/lib/mysql/mysql-connector-java-5.1.6-bin.jar</code></p>
<p>In the config folder we need some property files to configure the build.
<code>db/config/mysql.properties
db/config/xe.properties
db/config/schema.properties</code></p>
<p>Schema.properties is used to configure the build depending on whether you want to just use oracle xe or mysql or use both.  In this example oraclexe is enabled and mysql is disabled.</p>
<p>schema.properties:
<code>##
## Use this property file to enable or disable the databases and
## schemas you want to run the build scripts against.
## Comment them out with a # if you don't want to enable a
## setting.

#Databases

xe.db.enable
xe.username=testdb
xe.password=testdb

#mysql.db.enable
#mysql.username=testdb
#mysql.password=testdb</code></p>
<p>The next two give the access details for your oracle xe and mysql databases.</p>
<p>mysql.properties:
<code># MySql Database Details
mysql.rootuser=root
mysql.rootpass=password
mysql.url=jdbc:mysql://localhost:3306
mysql.schema=testdb

mysql.driver=com.mysql.jdbc.Driver
mysql.user.location=localhost

mysql.create.tables.script=createTables.sql
mysql.drop.tables.script=dropTables.sql
mysql.populate.tables.script=populateTables.sql
mysql.testdata.script=testData.sql

print=false</code></p>
<p>xe.properties:
<code># Oracle XE Database Details
xe.rootuser=sys
xe.host=localhost
xe.sid=XE
xe.rootpass=password

xe.port=1521
xe.driver=oracle.jdbc.OracleDriver
xe.url=jdbc:oracle:thin:@${xe.host}:${xe.port}:${xe.sid}

xe.create.user.script=createUser.sql
xe.delete.user.script=dropUser.sql
xe.create.tables.script=createTables.sql
xe.drop.tables.script=dropTables.sql
xe.populate.tables.script=populateTables.sql
xe.testdata.script=testdata.sql

print=false</code></p>
<p>We start off with a master build.xml script in PROJECT_HOME which calls oraclexe/testdb/build-xe-testdb.xml and mysql/testdb/build-mysql-testdb.xml script.  The &#8216;ant dir&#8217; value specifies the directory the script to be called in, &#8216;antfile&#8217; gives the name of the script, and lastly you specify the target to be run in that script.</p>
<p>db/build.xml:
<code>&lt;?xml version="1.0"?&gt;

&lt;project basedir="." name="db-master-build" default="recreateTables"&gt;

  &lt;property name="build.dir" value="${basedir}/build" /&gt;

  &lt;target name="clean"&gt;
    &lt;delete dir="${build.dir}" failonerror="false" /&gt;
  &lt;/target&gt;

  &lt;target name="install" depends="createUsers,createTables,populateTables,testData" description="Creates all users and schemas for a fresh install" /&gt;

  &lt;target name="recreateTables" description="Refreshes the database tables for all schemas"&gt;
    &lt;ant dir="oraclexe/testdb" antfile="build-xe-testdb.xml" target="recreateTables" /&gt;
    &lt;ant dir="mysql/testdb" antfile="build-mysql-testdb.xml" target="recreateTables" /&gt;
  &lt;/target&gt;

  &lt;target name="createUsers" description="Creates users for all schemas"&gt;
    &lt;ant dir="oraclexe/testdb" antfile="build-xe-testdb.xml" target="createUser" /&gt;
    &lt;ant dir="mysql/testdb" antfile="build-mysql-testdb.xml" target="createUser" /&gt;
  &lt;/target&gt;

  &lt;target name="dropUsers" description="Drops users for all schemas"&gt;
    &lt;ant dir="oraclexe/testdb" antfile="build-xe-testdb.xml" target="dropUser" /&gt;
    &lt;ant dir="mysql/testdb" antfile="build-mysql-testdb.xml" target="dropUser" /&gt;
  &lt;/target&gt;

  &lt;target name="createTables" description="Creates Database Tables for all schemas"&gt;
    &lt;ant dir="oraclexe/testdb" antfile="build-xe-testdb.xml" target="createTables" /&gt;
    &lt;ant dir="mysql/testdb" antfile="build-mysql-testdb.xml" target="createTables" /&gt;
  &lt;/target&gt;

  &lt;target name="populateTables" description="Populates Database Tables for all schemas"&gt;
    &lt;ant dir="oraclexe/testdb" antfile="build-xe-testdb.xml" target="populateTables" /&gt;
    &lt;ant dir="mysql/testdb" antfile="build-mysql-testdb.xml" target="populateTables" /&gt;
  &lt;/target&gt;

  &lt;target name="dropTables" description="Drops Database Tables for all schemas"&gt;
    &lt;ant dir="oraclexe/testdb" antfile="build-xe-testdb.xml" target="dropTables" /&gt;
    &lt;ant dir="mysql/testdb" antfile="build-mysql-testdb.xml" target="dropTables" /&gt;
  &lt;/target&gt;

  &lt;target name="testData" description="Refreshes test data for all schemas"&gt;
    &lt;ant dir="oraclexe/testdb" antfile="build-xe-testdb.xml" target="testData" /&gt;
    &lt;ant dir="mysql/testdb" antfile="build-mysql-testdb.xml" target="testData" /&gt;
  &lt;/target&gt;

&lt;/project&gt;</code></p>
<p>The install target is used to create the database schemas from scratch &#8211; including the users.</p>
<p>The recreateTables target is the default and is used when the schemas and users already exist and you just want to drop and create the tables to pick up changes.</p>
<p>The rest of the targets can be called separately for creating tables, populating them with default data (eg. lists of countries that would always be needed for an application) adding some test data and deleting the tables again.</p>
<p>The next step is to add the <a href="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NoZWlsYXBvbGxhcmQuY29tLzIwMDkvMDMvMjcvYXV0b21hdGVkLWJ1aWxkLW9yYWNsZXhlLWRhdGFiYXNlLXNjcmlwdHMvP3V0bV9jYW1wYWlnbj1mZWVkJnV0bV9tZWRpdW09ZmVlZCZ1dG1fc291cmNlPWJsb2c=">oraclexe</a>-specific scripts and the <a href="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NoZWlsYXBvbGxhcmQuY29tLzIwMDkvMDMvMzAvYXV0b21hdGVkLWJ1aWxkLW15c3FsLWRhdGFiYXNlLXNjcmlwdHMv">mysql</a>-specific scripts.</p>
<br /><a href="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NoZWlsYXBvbGxhcmQud29yZHByZXNzLmNvbS8/cD0xOTcjY29tbWVudHM=" title=\"Comments on &quot;Automated Build &#8211; Database scripts&quot;\"><img src="http://sheilapollard.com/wp-content/plugins/feed-comments-number/image.php?197" alt="Comments" /></a> <img src="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?view=1&post_id=197" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://sheilapollard.com/2009/03/25/automated-build-database-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
