Wednesday, April 07, 2010

Lesser-Known Java Pearls: jDBI for straight-forward SQL access

Ok: here is another pleasant recent discovery: jDBI library for doing SQL access. This is library that if it didn't exist, I would need to write. Actually, I have written fragments of it multiple times (and not as well); but no more.

So what is it? It is like starting with something like Spring's JdbTemplate (to do away with having all those boilerplate try-catch-close constructs); adding convention name-bound variables, and convenience methods for common things like accessing first row of result set, binding single-column values, and building batch inserts/updates. Common, common-sense things that most developers would quickly build on top of "raw" JDBC access, in cases where full ORM solution is either overkill, or gets overly complicated. And using my favorite design principle of building something that "just works".

I will try to come up with some sample code to show why I think it's cat's meow, but right now I just want to mention that it exists, since javadocs and Brian's jDBI blog entry should be able to guide brave adopters on right path. API is intuitive, so even if method descriptions on Javadocs are bit sparse it should be possible

ps. I originally posted this on April 1st. I should have paid more attention to timing... :-)

blog comments powered by Disqus

Sponsored By


Related Blogs

(by Author (topics))

Powered By

About me

  • I am known as Cowtowncoder
  • Contact me at@yahoo.com
Check my profile to learn more.