Code example for PreparedStatement

Methods: execute, setLong, setString

0
				protocol.getHealthCareSite().getStudyParticipantAssignment().getActivity()
						.getProcedure(); 
		try 
		{ 
			ps = con.prepareStatement("insert into PROCEDURE (ID, FASTING_STATUS)  values(?,?)");
			ps.setLong(1, procedure.getId());
			ps.setString(2, procedure.getFastingStatus());
			ps.execute();
 
		} 
		catch (SQLException se)
		{ 
			logger.error("Error saving the Procedure",se);
			throw (new Exception(se.getLocalizedMessage()));
 
		} 
		finally 
		{ 
			//clean up 
			ps = SQLHelper.closePreparedStatement(ps);
		} 
		if (procedure.getSpecimenCollection() != null)
		{ 
			procedure.getSpecimenCollection().setProcedureActivityId(procedure.getId());
			// save SpecimenCollection