Archive for July, 2008
Finally Closing of JDBC Resources
July 30th, 2008 by Scott SelikoffI 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 [...]
Categories: JDBC.
Tags: closing, J2EE, Java/J2EE, JDBC, Resources
Comments: 1
Because For loops are vastly superior to If statements
July 25th, 2008 by Scott SelikoffBecause 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;
// [...]
Categories: JDBC, WTFs.
Tags: For Loop, Java/J2EE, JDBC, WTFs
Comments: none
