Have you tried searching/asking this question on the DbUnit mailing list?
They might have more experience trying to accomplishing such a feat.
Matt
On 12/4/06, Christopher Thaddeus Kwiatkowski <[EMAIL PROTECTED]> wrote:
Hello all,
I have a situation where I need to create 5 local test databases that
mirror 5 databases in a production environment. I modified the
metadata/sql/mysql-create.sql file so that the 5 databases are created
and 'test' is given privileges to all of them. I want to be able to use
DB-UNIT to populate all f9ve of my databases when I run the db-load
task. The problem is that the db-load task only points at one
database. Since I am no Ant guru, I don't know how to set up the
db-load so that I can load all of my test data from a file
(metadata/sql/sample-data.xml) or a set of files to the multiple
databases. Currently I get the org.dbunit.dataset.NoSuchTableException
when I run the task. Has anyone figured out an
elegant/not-very-invasive way of doing this? All I can think of doing
is creating multiple sample-data-${dbname}.xml files and setting up
multiple dbunit drivers in sequence within the db-load target in the
build.xml.
What I would like to do is prefix the table names in sample-data.xml
with the database name <table name= 'PBBA.MY_TABLE'><!--stuff--></table>
<table name= 'PCFA.MY_TABLE'><!--stuff--></table> and have db-unit
connect to a datasource instead of a specific database.
I checked out the DBUnit Ant integration at
http://www.dbunit.org/anttask.html but I didn't find any mention of
loading just the datasource into DBUnit.
Thanks in advance for your suggestions and your help!
--
Christopher Kwiatkowski
create database if not exists @DB-NAME@;
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@"%" identified by
"@DB-PASSWORD@";
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@localhost identified
by "@DB-PASSWORD@";
-- Extra user/host privilege added to account for Fedora Core default
hostname quirk.
grant all privileges on @[EMAIL PROTECTED] to
@DB-USERNAME@@localhost.localdomainidentified by "@DB-PASSWORD@";
create database if not exists @DB-NAME-PAHR@;
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@"%" identified
by "@DB-PASSWORD@";
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@localhost
identified by "@DB-PASSWORD@";
-- Extra user/host privilege added to account for Fedora Core default
hostname quirk.
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@
localhost.localdomain identified by "@DB-PASSWORD@";
create database if not exists @DB-NAME-PBBS@;
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@"%" identified
by "@DB-PASSWORD@";
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@localhost
identified by "@DB-PASSWORD@";
-- Extra user/host privilege added to account for Fedora Core default
hostname quirk.
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@
localhost.localdomain identified by "@DB-PASSWORD@";
create database if not exists @DB-NAME-PBVC@;
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@"%" identified
by "@DB-PASSWORD@";
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@localhost
identified by "@DB-PASSWORD@";
-- Extra user/host privilege added to account for Fedora Core default
hostname quirk.
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@
localhost.localdomain identified by "@DB-PASSWORD@";
create database if not exists @DB-NAME-PCFA@;
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@"%" identified
by "@DB-PASSWORD@";
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@localhost
identified by "@DB-PASSWORD@";
-- Extra user/host privilege added to account for Fedora Core default
hostname quirk.
grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@
localhost.localdomain identified by "@DB-PASSWORD@";
-- You may have to explicitly define your hostname in order for things
-- to work correctly. For example:
-- grant all privileges on @[EMAIL PROTECTED] to @DB-USERNAME@@host.domain.comidentified
by "@DB-PASSWORD@";
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
http://raibledesigns.com