Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6150265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:35:30+00:00 2026-05-23T19:35:30+00:00

I use dbunit to test db operations in my webapp.Recently ,I used dbunits ant

  • 0

I use dbunit to test db operations in my webapp.Recently ,I used dbunits ant task org.dbunit.ant.DbUnitTask to create an xml representation of items in my database.I got this

<?xml version='1.0' encoding='UTF-8'?>
<dataset>
  <table name="AUTHOR">
    <column>AUTHOR_ID</column>
    <column>AUTHOR_NAME</column>
    <column>AUTHOR_ADDRESS</column>
    <row>
      <value>0</value>
      <value>j.k.rowling</value>
      <value>london</value>
    </row>
    <row>
      <value>1</value>
      <value><![CDATA[stephen king]]></value>
      <value><![CDATA[castle rock,maine]]></value>
    </row>
  </table>
...

I wanted to clean insert into the db ,values from this xml file.In a testcase’s you do this by

public void init() throws FileNotFoundException, IOException, ClassNotFoundException, SQLException, DatabaseUnitException {
        connection = DbUnitUtils.createConnection();
        try {
            DatabaseOperation.CLEAN_INSERT.execute(connection,DbUnitUtils.createDataSet("initialdata.xml"));
        }finally {
            connection.close();
        }
    }

I wanted to do the same using an ant target.So I wrote

<target name="insertdata" depends="startdb">
        <dbunit driver="${db.driver}"
            url="${db.url}"
            userid="${db.username}"
            password="${db.password}">
            <operation type="CLEAN_INSERT" src="data/dbunit/initialdata.xml"/>
        </dbunit>

    </target>

<taskdef 
    name="dbunit" 
    classname="org.dbunit.ant.DbUnitTask"
    classpathref="clientclasspath"
    />

where the driver.username,password etc are taken from a properties file

However,I get this error

insertdata:
   [dbunit] Executing operation: CLEAN_INSERT
   [dbunit]           on   file: C:\code\jee\myapp\data\dbunit\initialdata.xml
   [dbunit]           with format: null
   [dbunit] 550 [main] ERROR org.dbunit.database.DatabaseDataSet - Table 'value' not found in tableMap=org.dbunit.dataset.OrderedTableNameMa
p[_tableNames=[AUTHOR], _tableMap={AUTHOR=null}, _caseSensitiveTableNames=false]

Can anyone make sense of this error?The same xml file when passed to the method DatabaseOperation.CLEAN_INSERT.execute(connection,DbUnitUtils.createDataSet("initialdata.xml"))

succeeds in cleanly inserting the data.

Any help welcome

thanks

mark

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:35:31+00:00Added an answer on May 23, 2026 at 7:35 pm

    I’m not sure what the DbUnitUtils.createDataSet() method is up to, but it looks like you may need to specify the format for the XML as xml – i.e. conforming to the fixed DTD of an XMLDataSet. The Ant task assumes flat format if you don’t specify one, and flat format doesn’t look like your example XML.

    <operation type="CLEAN_INSERT" src="data/dbunit/initialdata.xml" format="xml" />
    

    See Parameters specified as nested elements for operation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I do not want to use the Xml/dtd files to create a IDataSet in
I used to use DBUnit to populate my database with classes/records expected by my
I'm trying to use DBUnit to test my DAO layer methods. Every method needs
I'm attempting to set up my unit testing environment to use DbUnit. I'm having
I am trying to use DBUnit with plain JDBC and HSQLDB, and can't quite
So I'm writing a ant build file to run some tests, and I use
I am trying to get scala specs and unitils-dbunit to work. To use unitils
I want to create a test suit for my java web application. Its a
I'm getting this error when I start up my application Caused by: org.dbunit.dataset.NoSuchColumnException: CLIENT.ID
I use DbUnit for unit-testing of my DAO objects. It works great so far.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.