공부방/JSP
DB접속 후 일반적인 작업 패턴
박재윤
2013. 1. 28. 16:13
DLETE 메소드 실행 시
public void deleteData(int seq) { String sql = "delete from KSPARK where seq=" + seq; Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { conn = ConnectDB(); pstmt = conn.prepareStatement(sql); rs = pstmt.executeQuery(); } catch (SQLException e) { System.out.println(e.getMessage()); } finally { try { conn.close(); } catch (SQLException e) { } try { pstmt.close(); } catch (SQLException e) { } try { rs.close(); } catch (SQLException e) { } } }