August 23, 2006
Submitted by Matt Casters, Chief of Data Integration, Pentaho
Hi Kettle fans,
Yesterday, Kettle developer and all around great guy Sven Boden commited some very interesting stuff to the Kettle codebase: support for LOB, BLOB and other Binary database objects.
The feature request behind this has been hanging around for some time now.
If you get a hold of the latest kettle.jar, you too can help us test this new functionality.
Currently we're testing on MySQL, Oracle, DB2 and Firebird although we're sure the code will work for more than just those databases.
The test transformation is the primary reason why I'm writing this short Weekly Kettle Tip: how do we load the content of a file into a binary value object?
Here is the code to do it:
file = new Packages.java.io.File(filename.getString());
fileInputStream = new Packages.java.io.FileInputStream(file);
var content = Packages.be.ibridge.kettle.core.Const.createByteArray(file.length());
fileInputStream.read(content, 0, file.length());
The example here loads all PNG image files in a certain directory and stores them into a database table.
So there you are, it's that simple! from now on, we should not be afraid to store and retrieve binary content.
Until next time,
P.S. Don't hesitate to create bug reports for this brand new feature. The more bug repors we get, the sooner we can fix what's broken!