Code example for PreparedStatement

Methods: execute, setDate, setString

0
		PreparedStatement stat = null;
		if (null == accessDate) accessDate = date;
		try { 
			conn = this.getConnection();
			stat = conn.prepareStatement(sql);
			stat.setDate(1, new java.sql.Date(accessDate.getTime()));
			stat.setString(2, username);
			stat.execute();
		} catch (Throwable t) {
			processDaoException(t, "Errore nel settare data", "mockDate");
		}  finally { 
			this.closeDaoResources(null, stat, conn);
		} 
	} 
 
	/** 
	 * @uml.property  name="mOCK_ACCESS_DATE" 
	 */ 
	private String MOCK_ACCESS_DATE = 
		"UPDATE authusers SET lastaccess = ? WHERE username = ? ";