Finally Closing of JDBC Resources

Site menu:

Topics

Recent Posts

Blog

 

July 2008
M T W T F S S
    Aug »
 123456
78910111213
14151617181920
21222324252627
28293031  

Past Posts

Links:

Archive for July, 2008

Finally Closing of JDBC Resources

July 30th, 2008 by Scott Selikoff

I love reading Alex’s The Daily WTF and I noticed the recent Finally WTF is relevant to JDBC in an important way. All *good* JDBC developers already know you should close your result sets, statements, and connections (in that order) in a finally block when you are done with them, but do you all [...]

Because For loops are vastly superior to If statements

July 25th, 2008 by Scott Selikoff

Because For loops are vastly superior to If statements I give my own WTF for the day:

private boolean someMethod() {
   int count = 0;
   ResultSet rs = statement.executeQuery("select count(*) FROM …");
   for ( ; rs.next(); ) {
      count = rs.getInt(1);
      break;
   }
   if ( 0 < count ) return false;
   // [...]