Hi all,
just for the archive. I found an old post in this list about this topic but no solution was found.
Here it is now.

Q: How do I insert binary data into the DB using dbunit? Without inserting the data in the xml itself, of course.

A: It's simple. Although DBUnit claims to have support for loading binary data from external files no documentation is provided. Just insert an url (e.g. http://www.blah.com/blah.jpg) or a path to a file. Relative paths have to start with ./ . A relative path has to start from the dir where maven has been executed, e.g core/.

This excerpt from my sample-data.xml works for me, using latest dbunit, executing maven in core:
       <row>
           <value description="id">-1</value>
           <value description="name">An image!</value>
           <value description="description">
               An image which shows something!
           </value>
           <value description="width">800</value>
           <value description="height">600</value>
           <value description="contentType">image/jpg</value>
           <value description="size">39315</value>
           <value description="version">0</value>
<value description="data">./src/test/resources/gr/ksi/op2/resources/impl/image1.jpg</value>
       </row>

Remaing problems:
dbunit can't find the path if maven is executed in the dir of the parent pom.xml.

Hope this helps,
Joachim

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to