public int insert(Member member) throws Exception { Connection con = null; PreparedStatement stmt = null; try { con = dataSource.getConnection(); stmt = con.prepareStatement("insert into MEMBERS(MNAME,EMAIL,PWD,TEL)" + " values(?,?,?,?)"); stmt.setString(1, member.getName()); stmt.setString(2, member.getEmail()); stmt.setString(3, member.getPassword()); stmt.setString(4, member.getTel()); return stmt.executeUpdate(); } finally { try { stmt.close(); } catch (Exception e) { } dataSource.returnConnection(con); } }
public int update(Member member) throws Exception { Connection con = null; PreparedStatement stmt = null; try { con = dataSource.getConnection(); stmt = con.prepareStatement("update MEMBERS set MNAME=?, EMAIL=?, PWD=?, TEL=? where MNO=?"); stmt.setString(1, member.getName()); stmt.setString(2, member.getEmail()); stmt.setString(3, member.getPassword()); stmt.setString(4, member.getTel()); stmt.setInt(5, member.getNo()); return stmt.executeUpdate(); } finally { try { stmt.close(); } catch (Exception e) { } dataSource.returnConnection(con); } }