Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFcccc
private Boolean validateValue(long time) {
  // performPerform validation
  return true; // ifIf the time is valid	
}

private void storeDateinDB(java.util.Date date) throws SQLException {
  final java.util.Date copy = (java.util.Date)date.clone();
  validateValue(copy.getTime());

  Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://<HOST>:1433","<UID>","<PWD>");

  PreparedStatement pstmt = con.prepareStatement("UPDATE ACCESSDB SET TIME = ?");
  pstmt.setLong(1, copy.getTime());
  // ...
}	

...