1: Connection conn = null; 2: PreparedStatement pstmt = null; 3: try { 4: conn=getConnection(); 5: ... 6: pstmt = conn.prepareStatement("SELECT * FROM employees 7: where name=?"); 8: ... 9: }catch (SQLException ex) {...} 10: // 자원을 사용하고 해제 시 항상 finally문에서 한다. 11: finally { 12: if ( conn!= null ) try { conn.close(); } catch (SQLException e){...} 13: if ( pstmt!= null ) try { pstmt.close(); } catch (SQLException e){...} 14: }