@Override public void update(TaskBean t) { SQLConnUtil sql = SQLConnUtil.getInstance(); Connection conn = sql.openConnection(); try { PreparedStatement ps = conn.prepareStatement( "insert into TASK(userid,category,task,taskdate,tasktime,priority,taskgroup,done) values(?,?,?,?,?,?,?,'n')"); ps.setString(1, t.getUserid()); ps.setString(2, t.getCategory()); ps.setString(3, t.getTask()); ps.setString(4, t.getTaskdate().toString()); ps.setString(5, t.getTasktime().toString()); ps.setInt(6, t.getPriority()); ps.setInt(7, t.getTaskgroup()); ps.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { sql.closeConnection(); } }
@Override public boolean signup(UserBean userBean) { System.out.println(userBean.getUserid() + " " + userBean.getPassword()); SQLConnUtil sql = SQLConnUtil.getInstance(); Connection conn = sql.openConnection(); try { Statement st = conn.createStatement(); PreparedStatement ps = conn.prepareStatement("insert into user values(?,?)"); ps.setString(1, userBean.getUserid()); ps.setString(2, userBean.getPassword()); ps.executeUpdate(); return true; } catch (SQLException e) { System.out.println("exception"); return false; } finally { sql.closeConnection(); } }