This post originated from an RSS feed registered with Java Buzz
by Marc Logemann.
Original Post: JDBC4 - great for blob handling
Feed Title: Logemann Blog
Feed URL: http://www.logemann.org/blojsom/blog/default/?flavor=rss2
Feed Description: Marc's thoughts on Java and more
Currently i am writing a unit test for a cache implementation which is 100% oracle only (this is freelance work and is not related to my product, furthermore i have not written the implementation). So we use an embedded db like derby to test the cache impl against. Of course it was quite fun so far to workaround all those oracle specific sqls but all manageable.
Now one of the last things i have to do was to convert an sql which uses EMPTY_BLOB() function from oracle. The first thing i noticed is the lack of an equivalent function in derby. Hmpf. Ok, then i though i just create an empty blob myself in java so that after retrieving the initial "null" value of the blob field from derby, i place my inital blob in there and let the rest of the cache work as usual. But surprise surprise, there is no out-of-the-box implementation in the SDK for getting an empty but functional java.sql.Blob.
After googling a bit more i noticed that JDBC4 (which is of cours not an option for me because of complex policies at the company i work for at the moment) help here a lot. The Connection interface now has methods like createBlob() and createClob(). Nice to see. This doesnt help me of course in my situation but i will go ahead and create an empty blob implementation for myself.