Sunday, February 12, 2012

DbUnit BatchedStatements

We're using dbunit to insert test data, and noticed that it was really slow.
There's a feature that's disabled by default whic can speed this up considerably - batchedStatements.
The documentation for this isn't the easiest to find, but what you need is

<target name="load.data">
<dbunit driver="${your.driver}" url="${your.url}" userid="${your.user}" password="${your.password}" schema="${your.user}">
<dbconfig>
<property name="batchedStatements" value="true"/>
<property name="batchSize" value="500"/>
</dbconfig>
<operation type="INSERT" transaction="false" src="${basedir}/yourdata.xml">
</operation>
</dbunit>
</target>

For us turning on batchedStatements reduced the time taken for a typical import from around 90 seconds to around 5 seconds without any other changes. Yes, those numbers is correct.
Note - the documentation does say that it's turned off by default as it's not supported by some jdbc drivers, but we had no problems with the oracle jdbc thin driver.

Monday, July 27, 2009

updating jar files for a running program is a bad idea


Updating jar files that a program is using is really not a good idea, but i wouldn't have expected it to cause jvm crashes. On solaris it does java bug 4425695
This isn't something you'd normally come across - we did because of a problem in our CI build, meaning that one build could overwrite the jars while another was already running.

Saturday, July 11, 2009

eclipse gets column mode

Finally, eclipse gets column mode (block select) in Galileo.
This is where you can select a whole column of text, and when you type it edit the same section of each line all at once.
To try it out just hit Alt-shift-A in the java editor. All the good stuff works - and copy/paste does what you'd expect.
So why column mode? While it doesn't actually give you anything that a search/replace doesn't it just seems less distracting than having to switch to a find/replace, then get back to what you were actually doing in the first place.
It's one of those little features that you rarely need to use, but when you do, make you're life just that tiny bit better.