public void memberUpdate(Member member) {
try {
connection = DriverManager.getConnection(url, uid, upw);
String query = "insert into memberforpre (id, pw, name, phone) values(?, ?, ?, ?)";
int n;
pstmt = connection.prepareStatement(query);
pstmt.setString(1, member.getId());
pstmt.setString(2, member.getPw());
pstmt.setString(3, member.getName());
pstmt.setString(4, member.getPhone());
n = pstmt.executeUpdate();
if (n == 1) {
System.out.println("insert success");
}else {
System.out.println("insert fail");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if(connection != null) connection.close();
if(pstmt != null) pstmt.close();
} catch (Exception e) {
// TODO: handle exception
}
}
}