Use "PreparedStatement":
// ...
String updateSQL = "UPDATE User SET userCreatedDate=? WHERE userId=?";
PreparedStatement stmt = conn.prepareStatement(updateSQL);
date = new java.util.Date();
stmt.setDate(
1,
new java.sql.Date(
date.getYear(),
date.getMonth(),
date.getDay()));
stmt.setString(2,userId);
int updatedRowCount = stmt.executeUpdate();
// ...
by Avatar Ng
[my blog http://avatar21.superihost.com/]